import { Observable } from "rxjs"; import { AccessLevel, IAccessRecord } from "../data/access"; import { IDataObject, IPerson, IType, IOrganisationUnit } from "../data"; import { IUserStateMachine } from "../data/user-state-machine"; /** * Represents the repository that provides access to objects, types, organisation units and people */ export interface IObjectsRepository { /** * Get objects with specified ids * * @param ids Ids of objects to subsribe * @returns */ getObjects(ids: string[]): Observable; /** * Get object's access for the person * * @param objectId Object id * @param personId Person Id * @returns Cold Observable */ getCurrentAccess(objectId: string, personId: number): Observable; /** * Get access records for the object * * @param objectId Object id * @param positions Person position ids * @returns Cold Observable */ getAccessRecords(objectId: string, positions: number[]): Observable; /** * Gets the person with specified id * * @param id Person id * @returns Person */ getPerson(id: number): IPerson; /** * Gets the current person * * @returns Person */ getCurrentPerson(): IPerson; /** * Gets all the people registred in database * * @returns Person[] */ getPeople(): IPerson[]; /** * Gets type by identifier * * @returns Type */ getType(id: number): IType; /** * Gets type by name * * @returns Type */ getTypeByName(name: string): IType; /** * Gets all the types registered in database * * @returns Type[] */ getTypes(): IType[]; /** * Gets organisation unit by identifier * * @returns OrganisationUnit */ getOrganisationUnit(id: number): IOrganisationUnit; /** * Get all the organisation units registered in database * * @returns OrganisationUnit */ getOrganisationUnits(): IOrganisationUnit[]; /** * Get all the user state machines registered in database * * @returns IUserStateMachine */ getUserStateMachines(): Map; }