import { ObjectId } from "mongodb";
import { inter } from "../ui/fonts";

export interface BillAttachment {
    fileName: string;
    fileSize: number;
    fileType: string;
    fileLastModified: number;
    fileContentsBase64: string;
};

export interface YearMonth {
    year: number;
    month: number;
};

/** bill object in the form returned by MongoDB */
export interface BillingLocation {
    _id: string;
    /** user's ID */
    userId: string;
    /** user's email */
    userEmail?: string | null;
    /** name of the location */
    name: string;
    /** billing period year and month */
    yearMonth: YearMonth;
    /** array of bills */
    bills: Bill[];
    /** (optional) notes */
    notes: string|null;
};

/** Bill basic data */
export interface Bill {
    _id: string;
    /** bill name */
    name: string;
    /** is the bill paid */
    paid: boolean;
    /** payed amount amount in cents */
    payedAmount?: number | null;
    /** attached document (optional) */
    attachment?: BillAttachment|null;
    /**
     * true if there an attachment
     * @description this field enables us to send this info to the client without sending large attachment - it's an optimization
    */
    hasAttachment?: boolean;
    /** (optional) notes */
    notes?: string|null;
    /** (optional) image data containing PDF471 bar code */
    barcodeImage?:string;
};