import { AccountProducts, Client, Product } from "@salaxy/core"; import { SessionService } from "../account/SessionService"; import { IRepository } from "./IRepository"; /** * Products are the services and external products that are available as part of Salaxy service: * Insurance, Pension company, Taxation and Unemployment options. * To the end user this is typically shown as settings in a user interface. */ export declare class ProductRepository implements IRepository { private client; /** The currently selected product */ current: Product; /** * Raw list of products as defined by IRepository * For user interfaces it is typically easier to bind to products property. */ readonly list: Product[]; /** * Returns either the model from the server or an empty object that can be used in data binding. */ readonly products: AccountProducts; private serverModel; private _anonModel; private readonly anonModel; /** Creates a new instance of ProductRepository with dependency injection. */ constructor(client: Client); /** * Assures the repository initialization: * Initialization is done after successful authentication. * Typically the call to fetch the repository list, but may fetch other stuff from the server. * * @param session - The session service that contains information about the authenticated user. */ init(session: SessionService): void; /** Gets a blank blank object */ getBlank?(): Product; /** * Gets a product of a given type. * @param typeName Name of the type (the asme as generic typ T). */ getProductByType(typeName: string): T; /** * Gets a product of a given id. * @param id Identifier of the product. */ getProductById(id: string): Product; /** Sets the current item using an id */ setCurrentId(id: string): void; /** Sets the current item as given object. */ setCurrent(item: Product): void; /** * Sets the current object as a new one. * In the case of products, essentially making it null. */ newCurrent?(): void; /** * Saves the entire products collection. * @param callback Optional callback that is called after the save has been done. */ save(callback?: any): void; /** * Saves the current object. * Note that currently this method saves the entire products property. * This may change later so that only the current product is changed. * This is not considered a breaking change. If you need consistent implementation, use saveAll() instead. * @param callback Optional callback that is called after the save has been done. */ saveCurrent(callback?: (savedProduct: Product) => any): void; /** * NOT IMPLEMENTED: Delete method is currently not implemented. * Will probably be implemented later as "Unsubscribe". */ delete?(id: string, callback?: () => any): void; /** Reloads the list from the server - called e.g. after delete and add new */ reloadList(): void; }