import { ElementMetaAttributes } from './element.interface' export interface HistoryPostData { text: string private: boolean parent_id?: string } export interface HistoryItem { _id: string author: { id: string name: string } created_at: string parent_id: string private: boolean text: string } export interface HistoryResponse { static: { multiplicity: { [type: string]: number } versionsByDay: { date: string; count: number }[] versionByOrganization: ResponseStaticVersionBySubject[] versionByUser: { id: string; versions: number }[] } history: HistoryRow[] } type ResponseStaticVersionBySubject = { id: string; versions: number } export interface HistoryRow { type: T timestamp: string author: { id: string; cn: string; sn: string } organization: { id: string } report: ReportTypesMap[T] expanded?: boolean } export type ViewReport = { attributes: string[] children: boolean parent: boolean reminders: boolean workRecords: boolean } export type ValueReport = { attribute: string created: (ValueType | FileType)[] deleted: (ValueType | FileType)[] new: (ValueType | FileType)[] previous: (ValueType | FileType)[] }[] export type ParentReport = { flag: keyof typeof changeParentFlags } & Record> export type ArchiveReport = { state: 'archived' | 'unarchived' } export interface ReportTypesMap { value: ValueReport view: ViewReport parent: ParentReport file: ValueReport archived: ArchiveReport } export const changeParentFlags = { changed: ['previous', 'new'], removed: ['removed'], set: ['setTo'], } as const interface Common { createdAt: Date organization: { id: string } } export interface FileType extends Common { fileName: string } export interface ValueType extends Common { value: string } export interface Previous extends ValueType { deletedAt: Date } export interface HistoryElement extends ElementMetaAttributes { element_name: { value: string } } export type HistoryType = | 'archived' | 'copy' | 'file' | 'fileComment' | 'parent' | 'ref' | 'reminder' | 'ticket' | 'transfer' | 'value' | 'view' | 'workRecord' | 'workRecordComment' export interface FilterData { 'from-date'?: string 'to-date'?: string users?: string[] actions?: string[] limit?: number page: number }