/* * 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 { Address, Address$Outbound, Address$outboundSchema, } from "./address.js"; import { Currency, Currency$outboundSchema } from "./currency.js"; import { CustomField, CustomField$Outbound, CustomField$outboundSchema, } from "./customfield.js"; import { LinkedCustomerInput, LinkedCustomerInput$Outbound, LinkedCustomerInput$outboundSchema, } from "./linkedcustomerinput.js"; import { LinkedTaxRateInput, LinkedTaxRateInput$Outbound, LinkedTaxRateInput$outboundSchema, } from "./linkedtaxrateinput.js"; import { LinkedTrackingCategory, LinkedTrackingCategory$Outbound, LinkedTrackingCategory$outboundSchema, } from "./linkedtrackingcategory.js"; /** * Current status of the project */ export const ProjectUpdateInputProjectStatus = { Active: "active", Completed: "completed", OnHold: "on_hold", Cancelled: "cancelled", Draft: "draft", InProgress: "in_progress", Approved: "approved", Other: "other", } as const; /** * Current status of the project */ export type ProjectUpdateInputProjectStatus = OpenEnum< typeof ProjectUpdateInputProjectStatus >; /** * Type or category of the project */ export const ProjectUpdateInputProjectType = { ClientProject: "client_project", InternalProject: "internal_project", Maintenance: "maintenance", ResearchDevelopment: "research_development", Training: "training", Other: "other", } as const; /** * Type or category of the project */ export type ProjectUpdateInputProjectType = OpenEnum< typeof ProjectUpdateInputProjectType >; /** * Priority level of the project */ export const ProjectUpdateInputPriority = { Low: "low", Medium: "medium", High: "high", Critical: "critical", } as const; /** * Priority level of the project */ export type ProjectUpdateInputPriority = OpenEnum< typeof ProjectUpdateInputPriority >; /** * Department or organizational unit associated with the project */ export type ProjectUpdateInputDepartment = { /** * Unique identifier for the department */ id?: string | undefined; /** * Name of the department */ name?: string | undefined; }; /** * Parent project if this is a subproject */ export type ProjectUpdateInputParentProject = { /** * Unique identifier for the parent project */ id?: string | undefined; /** * Name of the parent project */ name?: string | undefined; }; /** * Method used for billing this project */ export const ProjectUpdateInputBillingMethod = { FixedPrice: "fixed_price", TimeAndMaterials: "time_and_materials", MilestoneBased: "milestone_based", Retainer: "retainer", NonBillable: "non_billable", } as const; /** * Method used for billing this project */ export type ProjectUpdateInputBillingMethod = OpenEnum< typeof ProjectUpdateInputBillingMethod >; /** * Current phase of the project lifecycle */ export const ProjectUpdateInputProjectPhase = { Initiation: "initiation", Planning: "planning", Execution: "execution", Monitoring: "monitoring", Closure: "closure", Other: "other", } as const; /** * Current phase of the project lifecycle */ export type ProjectUpdateInputProjectPhase = OpenEnum< typeof ProjectUpdateInputProjectPhase >; /** * Current status of project schedule compared to plan */ export const ProjectUpdateInputScheduleStatus = { AheadOfSchedule: "ahead_of_schedule", OnSchedule: "on_schedule", BehindSchedule: "behind_schedule", CriticalDelay: "critical_delay", } as const; /** * Current status of project schedule compared to plan */ export type ProjectUpdateInputScheduleStatus = OpenEnum< typeof ProjectUpdateInputScheduleStatus >; /** * The writable shape of Project 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 ProjectUpdateInput = { /** * Name of the project */ name?: string | undefined; /** * User-friendly project identifier */ displayId?: string | null | undefined; /** * External reference identifier for the project */ referenceId?: string | null | undefined; /** * Detailed description of the project */ description?: string | null | undefined; /** * Current status of the project */ status?: ProjectUpdateInputProjectStatus | null | undefined; /** * Indicates whether the project is currently active or inactive */ active?: boolean | null | undefined; /** * Type or category of the project */ projectType?: ProjectUpdateInputProjectType | null | undefined; /** * Priority level of the project */ priority?: ProjectUpdateInputPriority | null | undefined; /** * Percentage of project completion (0-100) */ completionPercentage?: number | null | undefined; /** * Start date of the project */ startDate?: Date | null | undefined; /** * Expected or planned end date of the project */ endDate?: Date | null | undefined; /** * Actual end date of the project */ completionDate?: Date | null | undefined; /** * The customer this entity is linked to. */ customer?: LinkedCustomerInput | null | undefined; /** * Department or organizational unit associated with the project */ department?: ProjectUpdateInputDepartment | null | undefined; /** * The company ID the transaction belongs to */ companyId?: string | null | undefined; /** * ID of the user who owns/manages this project */ ownerId?: string | null | undefined; /** * Parent project if this is a subproject */ parentProject?: ProjectUpdateInputParentProject | 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; /** * Total budgeted amount for the project */ budgetAmount?: number | null | undefined; /** * Approved budget amount for the project */ approvedAmount?: number | null | undefined; /** * Total budgeted hours for the project */ budgetHours?: number | null | undefined; /** * Default hourly rate for project work */ hourlyRate?: number | null | undefined; /** * Method used for billing this project */ billingMethod?: ProjectUpdateInputBillingMethod | null | undefined; /** * Indicates if the project is billable to the customer */ isBillable?: boolean | null | undefined; /** * Current phase of the project lifecycle */ phase?: ProjectUpdateInputProjectPhase | null | undefined; taxRate?: LinkedTaxRateInput | undefined; /** * A list of linked tracking categories. */ trackingCategories?: Array | null | undefined; /** * Tags associated with the project */ tags?: Array | undefined; /** * Additional notes about the project */ notes?: string | null | undefined; /** * Contract or agreement number associated with the project */ contractNumber?: string | null | undefined; /** * Expected profit margin percentage for the project */ profitMargin?: number | null | undefined; /** * Current status of project schedule compared to plan */ scheduleStatus?: ProjectUpdateInputScheduleStatus | null | undefined; /** * An array of addresses associated with the project (billing, job site, etc.) */ addresses?: Array
| undefined; /** * Number of team members assigned to the project */ teamSize?: number | 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; }; /** @internal */ export const ProjectUpdateInputProjectStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, ProjectUpdateInputProjectStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ProjectUpdateInputProjectStatus) ); /** @internal */ export const ProjectUpdateInputProjectType$outboundSchema: z.ZodType< string, z.ZodTypeDef, ProjectUpdateInputProjectType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ProjectUpdateInputProjectType) ); /** @internal */ export const ProjectUpdateInputPriority$outboundSchema: z.ZodType< string, z.ZodTypeDef, ProjectUpdateInputPriority > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ProjectUpdateInputPriority) ); /** @internal */ export type ProjectUpdateInputDepartment$Outbound = { id?: string | undefined; name?: string | undefined; }; /** @internal */ export const ProjectUpdateInputDepartment$outboundSchema: z.ZodType< ProjectUpdateInputDepartment$Outbound, z.ZodTypeDef, ProjectUpdateInputDepartment > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), name: z.string().optional(), }) ); export function projectUpdateInputDepartmentToJSON( projectUpdateInputDepartment: ProjectUpdateInputDepartment, ): string { return JSON.stringify( ProjectUpdateInputDepartment$outboundSchema.parse( projectUpdateInputDepartment, ), ); } /** @internal */ export type ProjectUpdateInputParentProject$Outbound = { id?: string | undefined; name?: string | undefined; }; /** @internal */ export const ProjectUpdateInputParentProject$outboundSchema: z.ZodType< ProjectUpdateInputParentProject$Outbound, z.ZodTypeDef, ProjectUpdateInputParentProject > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), name: z.string().optional(), }) ); export function projectUpdateInputParentProjectToJSON( projectUpdateInputParentProject: ProjectUpdateInputParentProject, ): string { return JSON.stringify( ProjectUpdateInputParentProject$outboundSchema.parse( projectUpdateInputParentProject, ), ); } /** @internal */ export const ProjectUpdateInputBillingMethod$outboundSchema: z.ZodType< string, z.ZodTypeDef, ProjectUpdateInputBillingMethod > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ProjectUpdateInputBillingMethod) ); /** @internal */ export const ProjectUpdateInputProjectPhase$outboundSchema: z.ZodType< string, z.ZodTypeDef, ProjectUpdateInputProjectPhase > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ProjectUpdateInputProjectPhase) ); /** @internal */ export const ProjectUpdateInputScheduleStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, ProjectUpdateInputScheduleStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ProjectUpdateInputScheduleStatus) ); /** @internal */ export type ProjectUpdateInput$Outbound = { name?: string | undefined; display_id?: string | null | undefined; reference_id?: string | null | undefined; description?: string | null | undefined; status?: string | null | undefined; active?: boolean | null | undefined; project_type?: string | null | undefined; priority?: string | null | undefined; completion_percentage?: number | null | undefined; start_date?: string | null | undefined; end_date?: string | null | undefined; completion_date?: string | null | undefined; customer?: LinkedCustomerInput$Outbound | null | undefined; department?: ProjectUpdateInputDepartment$Outbound | null | undefined; company_id?: string | null | undefined; owner_id?: string | null | undefined; parent_project?: ProjectUpdateInputParentProject$Outbound | null | undefined; currency?: string | null | undefined; budget_amount?: number | null | undefined; approved_amount?: number | null | undefined; budget_hours?: number | null | undefined; hourly_rate?: number | null | undefined; billing_method?: string | null | undefined; is_billable: boolean | null; phase?: string | null | undefined; tax_rate?: LinkedTaxRateInput$Outbound | undefined; tracking_categories?: | Array | null | undefined; tags?: Array | undefined; notes?: string | null | undefined; contract_number?: string | null | undefined; profit_margin?: number | null | undefined; schedule_status?: string | null | undefined; addresses?: Array | undefined; team_size?: number | null | undefined; custom_fields?: Array | undefined; row_version?: string | null | undefined; }; /** @internal */ export const ProjectUpdateInput$outboundSchema: z.ZodType< ProjectUpdateInput$Outbound, z.ZodTypeDef, ProjectUpdateInput > = /* @__PURE__ */ lazySchema$(() => z.object({ name: z.string().optional(), displayId: z.nullable(z.string()).optional(), referenceId: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), status: z.nullable(ProjectUpdateInputProjectStatus$outboundSchema) .optional(), active: z.nullable(z.boolean()).optional(), projectType: z.nullable(ProjectUpdateInputProjectType$outboundSchema) .optional(), priority: z.nullable(ProjectUpdateInputPriority$outboundSchema).optional(), completionPercentage: z.nullable(z.number()).optional(), startDate: z.nullable( z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)), ).optional(), endDate: z.nullable( z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)), ).optional(), completionDate: z.nullable( z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)), ).optional(), customer: z.nullable(LinkedCustomerInput$outboundSchema).optional(), department: z.nullable( z.lazy(() => ProjectUpdateInputDepartment$outboundSchema), ).optional(), companyId: z.nullable(z.string()).optional(), ownerId: z.nullable(z.string()).optional(), parentProject: z.nullable( z.lazy(() => ProjectUpdateInputParentProject$outboundSchema), ).optional(), currency: z.nullable(Currency$outboundSchema).optional(), budgetAmount: z.nullable(z.number()).optional(), approvedAmount: z.nullable(z.number()).optional(), budgetHours: z.nullable(z.number()).optional(), hourlyRate: z.nullable(z.number()).optional(), billingMethod: z.nullable(ProjectUpdateInputBillingMethod$outboundSchema) .optional(), isBillable: z.nullable(z.boolean().default(true)), phase: z.nullable(ProjectUpdateInputProjectPhase$outboundSchema).optional(), taxRate: LinkedTaxRateInput$outboundSchema.optional(), trackingCategories: z.nullable( z.array(z.nullable(LinkedTrackingCategory$outboundSchema)), ).optional(), tags: z.array(z.string()).optional(), notes: z.nullable(z.string()).optional(), contractNumber: z.nullable(z.string()).optional(), profitMargin: z.nullable(z.number()).optional(), scheduleStatus: z.nullable(ProjectUpdateInputScheduleStatus$outboundSchema) .optional(), addresses: z.array(Address$outboundSchema).optional(), teamSize: z.nullable(z.number().int()).optional(), customFields: z.array(CustomField$outboundSchema).optional(), rowVersion: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { displayId: "display_id", referenceId: "reference_id", projectType: "project_type", completionPercentage: "completion_percentage", startDate: "start_date", endDate: "end_date", completionDate: "completion_date", companyId: "company_id", ownerId: "owner_id", parentProject: "parent_project", budgetAmount: "budget_amount", approvedAmount: "approved_amount", budgetHours: "budget_hours", hourlyRate: "hourly_rate", billingMethod: "billing_method", isBillable: "is_billable", taxRate: "tax_rate", trackingCategories: "tracking_categories", contractNumber: "contract_number", profitMargin: "profit_margin", scheduleStatus: "schedule_status", teamSize: "team_size", customFields: "custom_fields", rowVersion: "row_version", }); }) ); export function projectUpdateInputToJSON( projectUpdateInput: ProjectUpdateInput, ): string { return JSON.stringify( ProjectUpdateInput$outboundSchema.parse(projectUpdateInput), ); }