import type { AccountPayableDistributionLine, AccountPayableDocument, AccountPayableDocumentLine, AccountPayableDueScheduleLine, Schema, OutgoingPayment, AccountPayableSettlement, } from "../lib/types"; import type { Account, Company, Currency, ItemValuationPolicyResolution, SupplierAccountReference, PurchaseOrderLineForMatching, ValuationPolicy, } from "./moduleMocks"; const createdAt = new Date("2024-01-01T00:00:00.000Z"); export const baseCompany = { id: "company-1", status: "ACTIVE", legalName: "Test Corp", baseCurrencyId: "currency-1", taxId: null, registrationNumber: null, street: "123 Main St", city: "New York", state: "NY", postalCode: "10001", country: "US", createdAt, updatedAt: createdAt, } as const satisfies Company; export const baseSupplierAccount = { id: "supplier-account-1", companyId: "company-1", accountStatus: "ACTIVE", partnerStatus: "ACTIVE", partnerId: "partner-1", code: "ACCOUNT-001", accountName: "Supplier account", partnerName: "Supplier One", preferredCurrencyId: null, defaultExpenseAccountId: null, } satisfies SupplierAccountReference; export const baseCurrency = { id: "currency-1", code: "USD", status: "ACTIVE", symbol: "$", name: "US Dollar", decimalPlaces: 2, isBaseCurrency: true, createdAt, updatedAt: createdAt, } as const satisfies Currency; export const expenseAccount = { id: "account-expense", code: "5000", name: "Cost of Goods Sold", accountType: "EXPENSE", companyId: baseCompany.id, status: "ACTIVE", createdAt, updatedAt: createdAt, } as const satisfies Account; export const payableAccount = { id: "account-payable", code: "2100", name: "Accounts Payable Control", accountType: "LIABILITY", companyId: baseCompany.id, status: "ACTIVE", createdAt, updatedAt: createdAt, } as const satisfies Account; export const accrualAccount = { id: "account-accrual", code: "2110", name: "Goods Received Not Invoiced", accountType: "LIABILITY", companyId: baseCompany.id, status: "ACTIVE", createdAt, updatedAt: createdAt, } as const satisfies Account; export const invoicePriceVarianceAccount = { id: "account-invoice-price-variance", code: "5150", name: "Invoice Price Variance", accountType: "EXPENSE", companyId: baseCompany.id, status: "ACTIVE", createdAt, updatedAt: createdAt, } as const satisfies Account; export const baseAccountPayableDocument = { id: "ap-document-1", companyId: baseCompany.id, supplierAccountId: baseSupplierAccount.id, currencyId: baseCurrency.id, payableControlAccountId: payableAccount.id, documentType: "INVOICE", correctionOfId: null, documentNumber: "AP-10000001", externalDocumentNumber: "VEND-1001", documentDate: new Date("2024-01-10"), postingDate: new Date("2024-01-15"), totalAmount: "1000", description: "Vendor invoice", status: "DRAFT", registeredAt: null, postedAt: null, cancelledAt: null, createdAt, updatedAt: createdAt, } as const satisfies AccountPayableDocument; export const registeredAccountPayableDocument = { ...baseAccountPayableDocument, status: "REGISTERED", registeredAt: createdAt, } as const satisfies AccountPayableDocument; export const postedAccountPayableDocument = { ...registeredAccountPayableDocument, status: "POSTED", postedAt: createdAt, } as const satisfies AccountPayableDocument; export const creditMemoAccountPayableDocument = { ...registeredAccountPayableDocument, id: "ap-document-credit-1", documentType: "CREDIT_MEMO", } as const satisfies AccountPayableDocument; export const baseAccountPayableDocumentLine = { id: "ap-document-line-1", accountPayableDocumentId: baseAccountPayableDocument.id, netAmount: "1000", taxAmount: null, grossAmount: "1000", correctionOfLineId: null, correctionType: null, quantity: "10", unitPrice: "100", matchedPurchaseOrderUnitPrice: "100", unitId: "unit-1", description: "Purchase order line", sourceType: "PURCHASE_ORDER", purchaseOrderLineId: "purchase-order-line-1", createdAt, updatedAt: createdAt, } as const satisfies AccountPayableDocumentLine; export const baseAccountPayableDistributionLine = { id: "ap-distribution-line-1", accountPayableDocumentLineId: baseAccountPayableDocumentLine.id, correctionOfDistributionLineId: null, accountId: expenseAccount.id, amount: "1000", distributionType: "MANUAL", description: "Expense distribution", createdAt, updatedAt: createdAt, } as const satisfies AccountPayableDistributionLine; export const baseAccountPayableDueScheduleLine = { id: "ap-due-schedule-line-1", accountPayableDocumentId: baseAccountPayableDocument.id, dueDate: new Date("2024-02-15"), amount: "1000", createdAt, updatedAt: createdAt, } as const satisfies AccountPayableDueScheduleLine; export const paymentAccount = { id: "account-payment", code: "1100", name: "Outgoing Payment Clearing", accountType: "ASSET", companyId: baseCompany.id, status: "ACTIVE", createdAt, updatedAt: createdAt, } as const satisfies Account; export const baseOutgoingPayment = { id: "outgoing-payment-1", companyId: baseCompany.id, supplierAccountId: baseSupplierAccount.id, currencyId: baseCurrency.id, paymentAccountId: paymentAccount.id, paymentDate: new Date("2024-01-20"), totalAmount: "1000", status: "DRAFT", postedAt: null, reversalDate: null, reversedAt: null, cancelledAt: null, createdAt, updatedAt: createdAt, } as const satisfies OutgoingPayment; export const postedOutgoingPayment = { ...baseOutgoingPayment, status: "POSTED", postedAt: createdAt, } as const satisfies OutgoingPayment; export const cancelledOutgoingPayment = { ...baseOutgoingPayment, status: "CANCELLED", cancelledAt: createdAt, } as const satisfies OutgoingPayment; export const baseAccountPayableSettlement = { id: "account-payable-settlement-1", sourceType: "OUTGOING_PAYMENT", outgoingPaymentId: baseOutgoingPayment.id, accountPayableDueScheduleLineId: baseAccountPayableDueScheduleLine.id, settledAmount: "1000", reversalOfSettlementId: null, createdAt, updatedAt: createdAt, } as const satisfies AccountPayableSettlement; export const basePurchaseOrderLineForMatching = { companyId: "company-1", supplierAccountId: baseSupplierAccount.id, id: "purchase-order-line-1", purchaseOrderId: "purchase-order-1", itemId: "item-1", quantity: "10", unitPrice: "100", unitId: "unit-1", requiresPhysicalReceipt: true, receivedQuantity: "10", } as const satisfies PurchaseOrderLineForMatching; export const baseValuationPolicy = { id: "valuation-policy-1", name: "Default Policy", companyId: baseCompany.id, costingMethod: "AVERAGE", defaultCompanyId: baseCompany.id, inventoryAccountId: "account-inventory", accrualAccountId: accrualAccount.id, invoicePriceVarianceAccountId: "account-invoice-price-variance", cogsAccountId: "account-cogs", ppvAccountId: "account-ppv", adjustmentAccountId: "account-adjustment", standardCostAdjustmentAccountId: "account-standard-cost-adjustment", consumedPriceVarianceAccountId: "account-consumed-price-variance", createdAt, updatedAt: createdAt, } as const satisfies ValuationPolicy; export const baseItemValuationPolicies = [ { itemId: basePurchaseOrderLineForMatching.itemId, valuationPolicy: baseValuationPolicy, }, ] as const satisfies ItemValuationPolicyResolution[];