/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "./sdk-validation-error.js"; import { Status, Status$inboundSchema } from "./status.js"; import { TaxRateEntityType, TaxRateEntityType$inboundSchema, } from "./tax-rate-entity-type.js"; import { TaxRateResponse, TaxRateResponse$inboundSchema, } from "./tax-rate-response.js"; export type TaxAssociationResponse = { /** * Whether this tax should be automatically applied */ autoApply?: boolean | undefined; createdAt?: Date | undefined; createdBy?: string | undefined; /** * Currency */ currency?: string | undefined; /** * EndDate is the optional date until which this association is active */ endDate?: Date | undefined; /** * ID of the entity this tax rate applies to */ entityId?: string | undefined; entityType?: TaxRateEntityType | undefined; /** * EnvironmentID is the ID of the environment this tax rate config belongs to */ environmentId?: string | undefined; /** * ID of the ent. */ id?: string | undefined; /** * Metadata holds the value of the "metadata" field. */ metadata?: { [k: string]: string } | undefined; /** * Priority for tax resolution (lower number = higher priority) */ priority?: number | undefined; /** * StartDate is the date from which this association is active */ startDate?: Date | undefined; status?: Status | undefined; taxRate?: TaxRateResponse | undefined; /** * Reference to the TaxRate entity */ taxRateId?: string | undefined; tenantId?: string | undefined; updatedAt?: Date | undefined; updatedBy?: string | undefined; }; /** @internal */ export const TaxAssociationResponse$inboundSchema: z.ZodMiniType< TaxAssociationResponse, unknown > = z.pipe( z.object({ auto_apply: types.optional(types.boolean()), created_at: types.optional(types.date()), created_by: types.optional(types.string()), currency: types.optional(types.string()), end_date: types.optional(types.date()), entity_id: types.optional(types.string()), entity_type: types.optional(TaxRateEntityType$inboundSchema), environment_id: types.optional(types.string()), id: types.optional(types.string()), metadata: types.optional(z.record(z.string(), types.string())), priority: types.optional(types.number()), start_date: types.optional(types.date()), status: types.optional(Status$inboundSchema), tax_rate: types.optional(TaxRateResponse$inboundSchema), tax_rate_id: types.optional(types.string()), tenant_id: types.optional(types.string()), updated_at: types.optional(types.date()), updated_by: types.optional(types.string()), }), z.transform((v) => { return remap$(v, { "auto_apply": "autoApply", "created_at": "createdAt", "created_by": "createdBy", "end_date": "endDate", "entity_id": "entityId", "entity_type": "entityType", "environment_id": "environmentId", "start_date": "startDate", "tax_rate": "taxRate", "tax_rate_id": "taxRateId", "tenant_id": "tenantId", "updated_at": "updatedAt", "updated_by": "updatedBy", }); }), ); export function taxAssociationResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TaxAssociationResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TaxAssociationResponse' from JSON`, ); }