import {
    DocumentVariantsValue,
    IApiResponse,
    ImageConfig,
    IRawImage,
    IDocumentFieldsOptions,
} from '@/modules/documents';
import { IDocsSchemaType } from '@/modules/form/types';
import { TAvailableDoc } from '@/modules/documents/type/api-module-document.type';

export interface IApiDocumentModule {
    getDocument: (id: number) => Promise<TAvailableDoc>;
    getDocuments: () => Promise<IApiResponse[]>;
    saveDocument: (args: { formData: TAvailableDoc }) => Promise<TAvailableDoc>;
    updateDocument: (args: {
        formData: TAvailableDoc;
        documentId: number;
    }) => Promise<TAvailableDoc>;
    deleteDocument: (id: number) => Promise<unknown>;
    saveImageDocument: (formData: IRawImage, documentId: number) => Promise<unknown>;
    deleteImageDocument: (imgId: number) => Promise<unknown>;
}

export interface IModuleDocumentProps {
    documentType: DocumentVariantsValue;
    isShowExampleImage?: boolean;
    isShowDeleteDocBtn?: boolean;
    isShowNotSaveDocBtn?: boolean;
    isShowSaveImageBlock?: boolean;
    /** Заголовок модалки просмотра фото в блоке сохранения изображений. */
    saveImagePreviewModalTitle?: string;
    initialValue?: TAvailableDoc;
    customDocsSchemaType?: IDocsSchemaType[];
    customImageField?: ImageConfig;
    api?: IApiDocumentModule;
    doc?: IApiResponse;
    rawImages?: IRawImage | null;
    fieldsOptions?: IDocumentFieldsOptions;
}

export interface IModuleDocumentEmit {
    'update:document': [IApiResponse];
    'remove:document': [number];
    back: [void];
    'get:camera-photo': [void];
}
