/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$ } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Currency, Currency$outboundSchema } from "./currency.js"; import { CustomField, CustomField$Outbound, CustomField$outboundSchema, } from "./customfield.js"; import { ExpenseReportLineItemInput, ExpenseReportLineItemInput$Outbound, ExpenseReportLineItemInput$outboundSchema, } from "./expensereportlineiteminput.js"; import { LinkedDepartmentInput, LinkedDepartmentInput$Outbound, LinkedDepartmentInput$outboundSchema, } from "./linkeddepartmentinput.js"; import { LinkedLedgerAccount, LinkedLedgerAccount$Outbound, LinkedLedgerAccount$outboundSchema, } from "./linkedledgeraccount.js"; import { LinkedLocationInput, LinkedLocationInput$Outbound, LinkedLocationInput$outboundSchema, } from "./linkedlocationinput.js"; import { LinkedSubsidiaryInput, LinkedSubsidiaryInput$Outbound, LinkedSubsidiaryInput$outboundSchema, } from "./linkedsubsidiaryinput.js"; import { LinkedTrackingCategory, LinkedTrackingCategory$Outbound, LinkedTrackingCategory$outboundSchema, } from "./linkedtrackingcategory.js"; import { PassThroughBody, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; /** * The employee who submitted the expense report. */ export type ExpenseReportUpdateInputEmployee = { /** * A unique identifier for the employee. */ id?: string | undefined; /** * The display name of the employee. */ displayName?: string | null | undefined; }; /** * The status of the expense report. */ export const ExpenseReportUpdateInputStatus = { Draft: "draft", Submitted: "submitted", Approved: "approved", Reimbursed: "reimbursed", Rejected: "rejected", Reversed: "reversed", Voided: "voided", } as const; /** * The status of the expense report. */ export type ExpenseReportUpdateInputStatus = OpenEnum< typeof ExpenseReportUpdateInputStatus >; /** * The accounting period the expense report is posted to. */ export type ExpenseReportUpdateInputAccountingPeriod = { /** * A unique identifier for the accounting period. */ id?: string | undefined; /** * The name of the accounting period. */ name?: string | null | undefined; }; /** * The person who approved the expense report. */ export type ExpenseReportUpdateInputApprovedBy = { /** * A unique identifier for the approver. */ id?: string | undefined; /** * The display name of the approver. */ displayName?: string | null | undefined; }; /** * The writable shape of ExpenseReport for a single-record update. Identical to the model with the read-only properties removed and no required properties, because PATCH is partial and the API already validates it that way. */ export type ExpenseReportUpdateInput = { /** * Id to be displayed. */ displayId?: string | null | undefined; /** * The expense report number. */ number?: string | null | undefined; /** * Title or purpose of the expense report. */ title?: string | null | undefined; /** * The employee who submitted the expense report. */ employee?: ExpenseReportUpdateInputEmployee | undefined; /** * The status of the expense report. */ status?: ExpenseReportUpdateInputStatus | null | undefined; /** * The date of the transaction - YYYY:MM::DDThh:mm:ss.sTZD */ transactionDate?: Date | null | undefined; /** * The date the expense report was posted to the general ledger. */ postingDate?: Date | null | undefined; /** * Date when reimbursement is due. */ dueDate?: Date | null | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; /** * Currency Exchange Rate at the time entity was recorded/generated. */ currencyRate?: number | null | undefined; /** * Subtotal amount, normally before tax. */ subTotal?: number | null | undefined; /** * Total tax amount applied to this transaction. */ totalTax?: number | null | undefined; /** * Total amount of all expense lines including tax. */ totalAmount?: number | null | undefined; /** * Total reimbursable amount (may differ from total if some expenses are non-reimbursable). */ reimbursableAmount?: number | null | undefined; /** * The memo of the expense report. */ memo?: string | null | undefined; department?: LinkedDepartmentInput | null | undefined; location?: LinkedLocationInput | null | undefined; account?: LinkedLedgerAccount | null | undefined; /** * The accounting period the expense report is posted to. */ accountingPeriod?: | ExpenseReportUpdateInputAccountingPeriod | null | undefined; /** * Expense line items linked to this expense report. */ lineItems?: Array | undefined; /** * Optional reference identifier for the transaction. */ reference?: string | null | undefined; subsidiary?: LinkedSubsidiaryInput | null | undefined; /** * A list of linked tracking categories. */ trackingCategories?: Array | null | undefined; /** * Amounts are including tax */ taxInclusive?: boolean | null | undefined; /** * The person who approved the expense report. */ approvedBy?: ExpenseReportUpdateInputApprovedBy | null | undefined; customFields?: Array | undefined; /** * A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object. */ rowVersion?: string | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; /** @internal */ export type ExpenseReportUpdateInputEmployee$Outbound = { id?: string | undefined; display_name?: string | null | undefined; }; /** @internal */ export const ExpenseReportUpdateInputEmployee$outboundSchema: z.ZodType< ExpenseReportUpdateInputEmployee$Outbound, z.ZodTypeDef, ExpenseReportUpdateInputEmployee > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), displayName: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { displayName: "display_name", }); }) ); export function expenseReportUpdateInputEmployeeToJSON( expenseReportUpdateInputEmployee: ExpenseReportUpdateInputEmployee, ): string { return JSON.stringify( ExpenseReportUpdateInputEmployee$outboundSchema.parse( expenseReportUpdateInputEmployee, ), ); } /** @internal */ export const ExpenseReportUpdateInputStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, ExpenseReportUpdateInputStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ExpenseReportUpdateInputStatus) ); /** @internal */ export type ExpenseReportUpdateInputAccountingPeriod$Outbound = { id?: string | undefined; name?: string | null | undefined; }; /** @internal */ export const ExpenseReportUpdateInputAccountingPeriod$outboundSchema: z.ZodType< ExpenseReportUpdateInputAccountingPeriod$Outbound, z.ZodTypeDef, ExpenseReportUpdateInputAccountingPeriod > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), name: z.nullable(z.string()).optional(), }) ); export function expenseReportUpdateInputAccountingPeriodToJSON( expenseReportUpdateInputAccountingPeriod: ExpenseReportUpdateInputAccountingPeriod, ): string { return JSON.stringify( ExpenseReportUpdateInputAccountingPeriod$outboundSchema.parse( expenseReportUpdateInputAccountingPeriod, ), ); } /** @internal */ export type ExpenseReportUpdateInputApprovedBy$Outbound = { id?: string | undefined; display_name?: string | null | undefined; }; /** @internal */ export const ExpenseReportUpdateInputApprovedBy$outboundSchema: z.ZodType< ExpenseReportUpdateInputApprovedBy$Outbound, z.ZodTypeDef, ExpenseReportUpdateInputApprovedBy > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), displayName: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { displayName: "display_name", }); }) ); export function expenseReportUpdateInputApprovedByToJSON( expenseReportUpdateInputApprovedBy: ExpenseReportUpdateInputApprovedBy, ): string { return JSON.stringify( ExpenseReportUpdateInputApprovedBy$outboundSchema.parse( expenseReportUpdateInputApprovedBy, ), ); } /** @internal */ export type ExpenseReportUpdateInput$Outbound = { display_id?: string | null | undefined; number?: string | null | undefined; title?: string | null | undefined; employee?: ExpenseReportUpdateInputEmployee$Outbound | undefined; status?: string | null | undefined; transaction_date?: string | null | undefined; posting_date?: string | null | undefined; due_date?: string | null | undefined; currency?: string | null | undefined; currency_rate?: number | null | undefined; sub_total?: number | null | undefined; total_tax?: number | null | undefined; total_amount?: number | null | undefined; reimbursable_amount?: number | null | undefined; memo?: string | null | undefined; department?: LinkedDepartmentInput$Outbound | null | undefined; location?: LinkedLocationInput$Outbound | null | undefined; account?: LinkedLedgerAccount$Outbound | null | undefined; accounting_period?: | ExpenseReportUpdateInputAccountingPeriod$Outbound | null | undefined; line_items?: Array | undefined; reference?: string | null | undefined; subsidiary?: LinkedSubsidiaryInput$Outbound | null | undefined; tracking_categories?: | Array | null | undefined; tax_inclusive?: boolean | null | undefined; approved_by?: ExpenseReportUpdateInputApprovedBy$Outbound | null | undefined; custom_fields?: Array | undefined; row_version?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const ExpenseReportUpdateInput$outboundSchema: z.ZodType< ExpenseReportUpdateInput$Outbound, z.ZodTypeDef, ExpenseReportUpdateInput > = /* @__PURE__ */ lazySchema$(() => z.object({ displayId: z.nullable(z.string()).optional(), number: z.nullable(z.string()).optional(), title: z.nullable(z.string()).optional(), employee: z.lazy(() => ExpenseReportUpdateInputEmployee$outboundSchema) .optional(), status: z.nullable(ExpenseReportUpdateInputStatus$outboundSchema) .optional(), transactionDate: z.nullable(z.date().transform(v => v.toISOString())) .optional(), postingDate: z.nullable( z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)), ).optional(), dueDate: z.nullable( z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)), ).optional(), currency: z.nullable(Currency$outboundSchema).optional(), currencyRate: z.nullable(z.number()).optional(), subTotal: z.nullable(z.number()).optional(), totalTax: z.nullable(z.number()).optional(), totalAmount: z.nullable(z.number()).optional(), reimbursableAmount: z.nullable(z.number()).optional(), memo: z.nullable(z.string()).optional(), department: z.nullable(LinkedDepartmentInput$outboundSchema).optional(), location: z.nullable(LinkedLocationInput$outboundSchema).optional(), account: z.nullable(LinkedLedgerAccount$outboundSchema).optional(), accountingPeriod: z.nullable( z.lazy(() => ExpenseReportUpdateInputAccountingPeriod$outboundSchema), ).optional(), lineItems: z.array(ExpenseReportLineItemInput$outboundSchema).optional(), reference: z.nullable(z.string()).optional(), subsidiary: z.nullable(LinkedSubsidiaryInput$outboundSchema).optional(), trackingCategories: z.nullable( z.array(z.nullable(LinkedTrackingCategory$outboundSchema)), ).optional(), taxInclusive: z.nullable(z.boolean()).optional(), approvedBy: z.nullable( z.lazy(() => ExpenseReportUpdateInputApprovedBy$outboundSchema), ).optional(), customFields: z.array(CustomField$outboundSchema).optional(), rowVersion: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { displayId: "display_id", transactionDate: "transaction_date", postingDate: "posting_date", dueDate: "due_date", currencyRate: "currency_rate", subTotal: "sub_total", totalTax: "total_tax", totalAmount: "total_amount", reimbursableAmount: "reimbursable_amount", accountingPeriod: "accounting_period", lineItems: "line_items", trackingCategories: "tracking_categories", taxInclusive: "tax_inclusive", approvedBy: "approved_by", customFields: "custom_fields", rowVersion: "row_version", passThrough: "pass_through", }); }) ); export function expenseReportUpdateInputToJSON( expenseReportUpdateInput: ExpenseReportUpdateInput, ): string { return JSON.stringify( ExpenseReportUpdateInput$outboundSchema.parse(expenseReportUpdateInput), ); }