/* * 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$, safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Address, Address$inboundSchema, Address$Outbound, Address$outboundSchema, } from "./address.js"; import { Currency, Currency$inboundSchema, Currency$outboundSchema, } from "./currency.js"; import { CustomField, CustomField$inboundSchema, CustomField$Outbound, CustomField$outboundSchema, } from "./customfield.js"; import { LinkedCustomer, LinkedCustomer$inboundSchema, } from "./linkedcustomer.js"; import { LinkedCustomerInput, LinkedCustomerInput$Outbound, LinkedCustomerInput$outboundSchema, } from "./linkedcustomerinput.js"; import { LinkedTaxRate, LinkedTaxRate$inboundSchema } from "./linkedtaxrate.js"; import { LinkedTaxRateInput, LinkedTaxRateInput$Outbound, LinkedTaxRateInput$outboundSchema, } from "./linkedtaxrateinput.js"; import { LinkedTrackingCategory, LinkedTrackingCategory$inboundSchema, LinkedTrackingCategory$Outbound, LinkedTrackingCategory$outboundSchema, } from "./linkedtrackingcategory.js"; /** * Current status of the project */ export const ProjectProjectStatus = { 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 ProjectProjectStatus = OpenEnum; /** * Type or category of the project */ export const ProjectType = { 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 ProjectType = OpenEnum; /** * Priority level of the project */ export const Priority = { Low: "low", Medium: "medium", High: "high", Critical: "critical", } as const; /** * Priority level of the project */ export type Priority = OpenEnum; /** * Department or organizational unit associated with the project */ export type ProjectDepartment = { /** * Unique identifier for the department */ id?: string | undefined; /** * Name of the department */ name?: string | undefined; }; /** * Parent project if this is a subproject */ export type ParentProject = { /** * 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 BillingMethod = { 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 BillingMethod = OpenEnum; /** * Current phase of the project lifecycle */ export const ProjectPhase = { Initiation: "initiation", Planning: "planning", Execution: "execution", Monitoring: "monitoring", Closure: "closure", Other: "other", } as const; /** * Current phase of the project lifecycle */ export type ProjectPhase = OpenEnum; /** * Current status of project schedule compared to plan */ export const ScheduleStatus = { 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 ScheduleStatus = OpenEnum; export type Project = { /** * A unique identifier for an object. */ id?: string | undefined; /** * The third-party API ID of original entity */ downstreamId?: string | null | undefined; /** * Name of the project */ name: string; /** * 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?: ProjectProjectStatus | null | undefined; /** * Indicates whether the project is currently active or inactive */ active?: boolean | null | undefined; /** * Type or category of the project */ projectType?: ProjectType | null | undefined; /** * Priority level of the project */ priority?: Priority | 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?: LinkedCustomer | null | undefined; /** * Department or organizational unit associated with the project */ department?: ProjectDepartment | 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?: ParentProject | 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 actual amount spent on the project */ actualAmount?: number | null | undefined; /** * Total budgeted hours for the project */ budgetHours?: number | null | undefined; /** * Total actual hours worked on the project */ actualHours?: number | null | undefined; /** * Default hourly rate for project work */ hourlyRate?: number | null | undefined; /** * Method used for billing this project */ billingMethod?: BillingMethod | null | undefined; /** * Indicates if the project is billable to the customer */ isBillable: boolean | null; /** * Current phase of the project lifecycle */ phase?: ProjectPhase | null | undefined; taxRate?: LinkedTaxRate | 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?: ScheduleStatus | 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; /** * The user who last updated the object. */ updatedBy?: string | null | undefined; /** * The user who created the object. */ createdBy?: string | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; }; export type ProjectInput = { /** * Name of the project */ name: string; /** * 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?: ProjectProjectStatus | null | undefined; /** * Indicates whether the project is currently active or inactive */ active?: boolean | null | undefined; /** * Type or category of the project */ projectType?: ProjectType | null | undefined; /** * Priority level of the project */ priority?: Priority | 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?: ProjectDepartment | 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?: ParentProject | 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?: BillingMethod | null | undefined; /** * Indicates if the project is billable to the customer */ isBillable?: boolean | null | undefined; /** * Current phase of the project lifecycle */ phase?: ProjectPhase | 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?: ScheduleStatus | 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 ProjectProjectStatus$inboundSchema: z.ZodType< ProjectProjectStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(ProjectProjectStatus) ); /** @internal */ export const ProjectProjectStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, ProjectProjectStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ProjectProjectStatus) ); /** @internal */ export const ProjectType$inboundSchema: z.ZodType< ProjectType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(ProjectType)); /** @internal */ export const ProjectType$outboundSchema: z.ZodType< string, z.ZodTypeDef, ProjectType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ProjectType)); /** @internal */ export const Priority$inboundSchema: z.ZodType< Priority, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(Priority)); /** @internal */ export const Priority$outboundSchema: z.ZodType< string, z.ZodTypeDef, Priority > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(Priority)); /** @internal */ export const ProjectDepartment$inboundSchema: z.ZodType< ProjectDepartment, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: types.optional(types.string()), }) ); /** @internal */ export type ProjectDepartment$Outbound = { id?: string | undefined; name?: string | undefined; }; /** @internal */ export const ProjectDepartment$outboundSchema: z.ZodType< ProjectDepartment$Outbound, z.ZodTypeDef, ProjectDepartment > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), name: z.string().optional(), }) ); export function projectDepartmentToJSON( projectDepartment: ProjectDepartment, ): string { return JSON.stringify( ProjectDepartment$outboundSchema.parse(projectDepartment), ); } export function projectDepartmentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ProjectDepartment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProjectDepartment' from JSON`, ); } /** @internal */ export const ParentProject$inboundSchema: z.ZodType< ParentProject, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: types.optional(types.string()), }) ); /** @internal */ export type ParentProject$Outbound = { id?: string | undefined; name?: string | undefined; }; /** @internal */ export const ParentProject$outboundSchema: z.ZodType< ParentProject$Outbound, z.ZodTypeDef, ParentProject > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), name: z.string().optional(), }) ); export function parentProjectToJSON(parentProject: ParentProject): string { return JSON.stringify(ParentProject$outboundSchema.parse(parentProject)); } export function parentProjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ParentProject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ParentProject' from JSON`, ); } /** @internal */ export const BillingMethod$inboundSchema: z.ZodType< BillingMethod, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(BillingMethod)); /** @internal */ export const BillingMethod$outboundSchema: z.ZodType< string, z.ZodTypeDef, BillingMethod > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(BillingMethod)); /** @internal */ export const ProjectPhase$inboundSchema: z.ZodType< ProjectPhase, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(ProjectPhase)); /** @internal */ export const ProjectPhase$outboundSchema: z.ZodType< string, z.ZodTypeDef, ProjectPhase > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ProjectPhase)); /** @internal */ export const ScheduleStatus$inboundSchema: z.ZodType< ScheduleStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(ScheduleStatus)); /** @internal */ export const ScheduleStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, ScheduleStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ScheduleStatus)); /** @internal */ export const Project$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), downstream_id: z.nullable(types.string()).optional(), name: types.string(), display_id: z.nullable(types.string()).optional(), reference_id: z.nullable(types.string()).optional(), description: z.nullable(types.string()).optional(), status: z.nullable(ProjectProjectStatus$inboundSchema).optional(), active: z.nullable(types.boolean()).optional(), project_type: z.nullable(ProjectType$inboundSchema).optional(), priority: z.nullable(Priority$inboundSchema).optional(), completion_percentage: z.nullable(types.number()).optional(), start_date: z.nullable(types.date()).optional(), end_date: z.nullable(types.date()).optional(), completion_date: z.nullable(types.date()).optional(), customer: z.nullable(LinkedCustomer$inboundSchema).optional(), department: z.nullable(z.lazy(() => ProjectDepartment$inboundSchema)) .optional(), company_id: z.nullable(types.string()).optional(), owner_id: z.nullable(types.string()).optional(), parent_project: z.nullable(z.lazy(() => ParentProject$inboundSchema)) .optional(), currency: z.nullable(Currency$inboundSchema).optional(), budget_amount: z.nullable(types.number()).optional(), approved_amount: z.nullable(types.number()).optional(), actual_amount: z.nullable(types.number()).optional(), budget_hours: z.nullable(types.number()).optional(), actual_hours: z.nullable(types.number()).optional(), hourly_rate: z.nullable(types.number()).optional(), billing_method: z.nullable(BillingMethod$inboundSchema).optional(), is_billable: z.nullable(types.boolean().default(true)), phase: z.nullable(ProjectPhase$inboundSchema).optional(), tax_rate: types.optional(LinkedTaxRate$inboundSchema), tracking_categories: z.nullable( z.array(types.nullable(LinkedTrackingCategory$inboundSchema)), ).optional(), tags: types.optional(z.array(types.string())), notes: z.nullable(types.string()).optional(), contract_number: z.nullable(types.string()).optional(), profit_margin: z.nullable(types.number()).optional(), schedule_status: z.nullable(ScheduleStatus$inboundSchema).optional(), addresses: types.optional(z.array(Address$inboundSchema)), team_size: z.nullable(types.number()).optional(), custom_fields: types.optional(z.array(CustomField$inboundSchema)), row_version: z.nullable(types.string()).optional(), updated_by: z.nullable(types.string()).optional(), created_by: z.nullable(types.string()).optional(), created_at: z.nullable(types.date()).optional(), updated_at: z.nullable(types.date()).optional(), }).transform((v) => { return remap$(v, { "downstream_id": "downstreamId", "display_id": "displayId", "reference_id": "referenceId", "project_type": "projectType", "completion_percentage": "completionPercentage", "start_date": "startDate", "end_date": "endDate", "completion_date": "completionDate", "company_id": "companyId", "owner_id": "ownerId", "parent_project": "parentProject", "budget_amount": "budgetAmount", "approved_amount": "approvedAmount", "actual_amount": "actualAmount", "budget_hours": "budgetHours", "actual_hours": "actualHours", "hourly_rate": "hourlyRate", "billing_method": "billingMethod", "is_billable": "isBillable", "tax_rate": "taxRate", "tracking_categories": "trackingCategories", "contract_number": "contractNumber", "profit_margin": "profitMargin", "schedule_status": "scheduleStatus", "team_size": "teamSize", "custom_fields": "customFields", "row_version": "rowVersion", "updated_by": "updatedBy", "created_by": "createdBy", "created_at": "createdAt", "updated_at": "updatedAt", }); }) ); export function projectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Project$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Project' from JSON`, ); } /** @internal */ export type ProjectInput$Outbound = { name: string; 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?: ProjectDepartment$Outbound | null | undefined; company_id?: string | null | undefined; owner_id?: string | null | undefined; parent_project?: ParentProject$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 ProjectInput$outboundSchema: z.ZodType< ProjectInput$Outbound, z.ZodTypeDef, ProjectInput > = /* @__PURE__ */ lazySchema$(() => z.object({ name: z.string(), displayId: z.nullable(z.string()).optional(), referenceId: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), status: z.nullable(ProjectProjectStatus$outboundSchema).optional(), active: z.nullable(z.boolean()).optional(), projectType: z.nullable(ProjectType$outboundSchema).optional(), priority: z.nullable(Priority$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(() => ProjectDepartment$outboundSchema)) .optional(), companyId: z.nullable(z.string()).optional(), ownerId: z.nullable(z.string()).optional(), parentProject: z.nullable(z.lazy(() => ParentProject$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(BillingMethod$outboundSchema).optional(), isBillable: z.nullable(z.boolean().default(true)), phase: z.nullable(ProjectPhase$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(ScheduleStatus$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 projectInputToJSON(projectInput: ProjectInput): string { return JSON.stringify(ProjectInput$outboundSchema.parse(projectInput)); }