import { GetStatementPeriodsQuery } from 'src/apollo/queries/statement-periods/__generated__/statement-periods';
import { GetVatInvoicesQuery } from 'src/apollo/queries/statement-periods/__generated__/get-vat-invoices';
import { INVOICE_STATUS } from 'src/enum';

type VatInvoice = GetVatInvoicesQuery['moneyhubStatementInvoices'][0];
type RecentStatementPeriod = NonNullable<
    GetStatementPeriodsQuery['abacusStatementPeriods']
>['recentPeriods'][0];
type UpcomingStatementPeriod = NonNullable<
    GetStatementPeriodsQuery['abacusStatementPeriods']
>['upcomingPeriods'][0];

export const createRecentStatementPeriod = (
    props: Partial<RecentStatementPeriod> = {}
): RecentStatementPeriod => ({
    statementPeriodId: '1',
    statementPeriodName: 'January 2020',
    statementPeriodStatus: 'current',
    closedBy: null,
    closedDate: null,
    actionStates: [],
    ...props,
});

export const createVatInvoice = (
    props: Partial<VatInvoice> = {}
): VatInvoice => ({
    accountId: '1',
    accountName: 'Account 1',
    contractId: '1',
    fileLocation: null,
    invoiceNumber: null,
    failureReason: null,
    statementAttachmentId: '123',
    statementAttachmentStatus: INVOICE_STATUS.COMPLETED,
    statementAttachmentType: 'distribution_fee_invoice',
    statementPeriodId: '295',
    ...props,
});

export const createUpcomingStatementPeriod = (
    props: Partial<UpcomingStatementPeriod> = {}
): UpcomingStatementPeriod => ({
    statementPeriodId: '1',
    statementPeriodName: 'January 2020',
    ...props,
});
