// Attachment interface is used by Attachment model
import { Readable } from 'stream';

declare global {
    interface AttachmentInterface {
        id?: number;
        fileName: string;
        userId: number | null;
        accountId: number | null;
        extension: string;
        uniqueName: string;
        filePath: string;
        type: number;
        size: number;
        thumbnails?: Record<string, unknown> | null;
        dataKey?: Text | string | null;
        altText?: string | null;
        caption?: string | null;
        title?: string | null;
        description?: Text | string | null;
        status: number;
    }

    interface fileOptions {
        dest: string,
        userId: number | null;
        accountId: number | null;
    }

    interface fileStreamData {
        streamData: Readable;
        attachment: attachmentObjectInteface;
    }

    interface fileObject {
        id: number;
        fileName?: string;
        filePath: string;
        cdnUrl?: string | null;
    }

    interface attachmentObjectInteface {
        thumbnails: string[] | Record<string, unknown> | null;
        videoResolution: string[];
        id: number;
        uniqueName: string;
        fileName: string;
        extension: string;
        filePath: string;
        type: number;
        author?: UserPublicObjectInterface | null;
        dataKey?: string;
        altText?: string | null;
        caption?: string | null;
        title?: string | null;
        description?: string | null;
        createdAt: Date;
        updatedAt: Date;
        size: number;
    }

    interface mailAttachment {
        filename?: string;
        content?: Buffer;
        path?: string;
    }

    interface AttachmentListRequestObject {
        page: number;
        perPage: number;
        searchText: string | null;
        sortBy: string;
        status: boolean;
        sortDirection: string;
    }

    interface AttachmentPaginatedData {
        count: number;
        rows: attachmentObjectInteface[]
    }

    interface DaoOptions {
        transaction?: import("sequelize").Transaction;
    }

    interface AttachmentUploadServiceInput {
        file: any;
        isGlobal?: boolean;
    }

    interface AttachmentGetFileByUniqueIdentifierServiceInput {
        id: number | null;
        uniqueName: string | null;
        size: string | null;
        format?: string | null;
    }

    interface AttachmentGetAllFileInfoServiceInput {
        listRequest: AttachmentListRequestObject;
    }

    interface AttachmentGetFileInfoServiceInput {
        id?: number | null;
        uniqueName?: string | null;
    }

    interface AttachmentDeleteServiceInput {
        id?: number | null;
        uniqueName?: string | null;
        authUserData: AuthCredentials | boolean;
    }

    interface AttachmentGetDaoInput {
        id?: number | null;
        uniqueName?: string | null;
        fullObject: boolean;
        paranoid?: boolean;
    }

    interface AttachmentGetAllDaoInput {
        ids?: number[] | null;
        uniqueNames?: string[] | null;
        fullObject: boolean;
        paranoid?: boolean;
    }

    interface AttachmentGetAllAttachmentsDaoInput {
        listRequest: AttachmentListRequestObject;
        fullObject: boolean;
        paranoid?: boolean;
    }

    interface AttachmentSaveDaoInput {
        attachmentData: AttachmentInterface;
    }

    interface AttachmentGetFileByNameDaoInput {
        uniqueName: string;
        fullObject?: boolean;
        paranoid?: boolean;
    }

    interface AttachmentGetFileByIdDaoInput {
        id: number;
        fullObject?: boolean;
        paranoid?: boolean;
    }

    interface AttachmentDeleteDaoInput {
        id: number;
        fullObject?: boolean;
        paranoid?: boolean;
    }

    interface AttachmentVerifyFilesDaoInput {
        ids: number[];
        fullObject?: boolean;
        paranoid?: boolean;
    }
}
export { Readable, AttachmentInterface, fileObject, attachmentObjectInteface, AttachmentListRequestObject, AttachmentPaginatedData }
