module attachment.data;

import handy_http_primitives : Optional;
import attachment.model;
import std.datetime;

interface AttachmentRepository {
    Optional!Attachment findById(ulong id);
    Attachment[] findAllByLinkedEntity(string subquery, ulong entityId);
    Attachment[] findAllByTransactionId(ulong transactionId);
    Attachment[] findAllByValueRecordId(ulong valueRecordId);
    Attachment[] findAllByTransactionDraftId(ulong draftId);
    ulong save(SysTime uploadedAt, string filename, string contentType, in ubyte[] content);
    void remove(ulong id);
    Optional!(ubyte[]) getContent(ulong id);
}
