import { IFileInfoModel, IBaseMongoRepository, AsDomainType } from 'common/server';

export interface IFileInfoRepository extends IBaseMongoRepository<IFileInfoModel> {
    /**
     * Finds a file by its URL
     *
     * @param {string} url - The URL of the file to find
     * @returns {Promise<AsDomainType<IFileInfoModel> | null>} The found file or null
     */
    findByUrl(url: string): Promise<AsDomainType<IFileInfoModel> | null>;

    /**
     * Finds files by reference and reference type
     *
     * @param {string} ref - The reference ID
     * @param {string} refType - The reference type
     * @returns {Promise<AsDomainType<IFileInfoModel>[]>} Array of matching files
     */
    findByReference(ref: string, refType: string): Promise<AsDomainType<IFileInfoModel>[]>;

    /**
     * Finds files by creator
     *
     * @param {string} createdBy - The creator ID
     * @returns {Promise<AsDomainType<IFileInfoModel>[]>} Array of files created by the user
     */
    findByCreator(createdBy: string): Promise<AsDomainType<IFileInfoModel>[]>;

    /**
     * Deletes files by reference and reference type
     *
     * @param {string} ref - The reference ID
     * @param {string} refType - The reference type
     * @returns {Promise<boolean>} Success status of deletion
     */
    deleteByReference(ref: string, refType: string): Promise<boolean>;
}
