"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProjectInput$outboundSchema = exports.Project$inboundSchema = exports.ScheduleStatus$outboundSchema = exports.ScheduleStatus$inboundSchema = exports.ProjectPhase$outboundSchema = exports.ProjectPhase$inboundSchema = exports.BillingMethod$outboundSchema = exports.BillingMethod$inboundSchema = exports.ParentProject$outboundSchema = exports.ParentProject$inboundSchema = exports.ProjectDepartment$outboundSchema = exports.ProjectDepartment$inboundSchema = exports.Priority$outboundSchema = exports.Priority$inboundSchema = exports.ProjectType$outboundSchema = exports.ProjectType$inboundSchema = exports.ProjectProjectStatus$outboundSchema = exports.ProjectProjectStatus$inboundSchema = exports.ScheduleStatus = exports.ProjectPhase = exports.BillingMethod = exports.Priority = exports.ProjectType = exports.ProjectProjectStatus = void 0;
exports.projectDepartmentToJSON = projectDepartmentToJSON;
exports.projectDepartmentFromJSON = projectDepartmentFromJSON;
exports.parentProjectToJSON = parentProjectToJSON;
exports.parentProjectFromJSON = parentProjectFromJSON;
exports.projectFromJSON = projectFromJSON;
exports.projectInputToJSON = projectInputToJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const rfcdate_js_1 = require("../../types/rfcdate.js");
const address_js_1 = require("./address.js");
const currency_js_1 = require("./currency.js");
const customfield_js_1 = require("./customfield.js");
const linkedcustomer_js_1 = require("./linkedcustomer.js");
const linkedcustomerinput_js_1 = require("./linkedcustomerinput.js");
const linkedtaxrate_js_1 = require("./linkedtaxrate.js");
const linkedtaxrateinput_js_1 = require("./linkedtaxrateinput.js");
const linkedtrackingcategory_js_1 = require("./linkedtrackingcategory.js");
/**
 * Current status of the project
 */
exports.ProjectProjectStatus = {
    Active: "active",
    Completed: "completed",
    OnHold: "on_hold",
    Cancelled: "cancelled",
    Draft: "draft",
    InProgress: "in_progress",
    Approved: "approved",
    Other: "other",
};
/**
 * Type or category of the project
 */
exports.ProjectType = {
    ClientProject: "client_project",
    InternalProject: "internal_project",
    Maintenance: "maintenance",
    ResearchDevelopment: "research_development",
    Training: "training",
    Other: "other",
};
/**
 * Priority level of the project
 */
exports.Priority = {
    Low: "low",
    Medium: "medium",
    High: "high",
    Critical: "critical",
};
/**
 * Method used for billing this project
 */
exports.BillingMethod = {
    FixedPrice: "fixed_price",
    TimeAndMaterials: "time_and_materials",
    MilestoneBased: "milestone_based",
    Retainer: "retainer",
    NonBillable: "non_billable",
};
/**
 * Current phase of the project lifecycle
 */
exports.ProjectPhase = {
    Initiation: "initiation",
    Planning: "planning",
    Execution: "execution",
    Monitoring: "monitoring",
    Closure: "closure",
    Other: "other",
};
/**
 * Current status of project schedule compared to plan
 */
exports.ScheduleStatus = {
    AheadOfSchedule: "ahead_of_schedule",
    OnSchedule: "on_schedule",
    BehindSchedule: "behind_schedule",
    CriticalDelay: "critical_delay",
};
/** @internal */
exports.ProjectProjectStatus$inboundSchema = z.nativeEnum(exports.ProjectProjectStatus);
/** @internal */
exports.ProjectProjectStatus$outboundSchema = exports.ProjectProjectStatus$inboundSchema;
/** @internal */
exports.ProjectType$inboundSchema = z
    .nativeEnum(exports.ProjectType);
/** @internal */
exports.ProjectType$outboundSchema = exports.ProjectType$inboundSchema;
/** @internal */
exports.Priority$inboundSchema = z
    .nativeEnum(exports.Priority);
/** @internal */
exports.Priority$outboundSchema = exports.Priority$inboundSchema;
/** @internal */
exports.ProjectDepartment$inboundSchema = z.object({
    id: z.string().optional(),
    name: z.string().optional(),
});
/** @internal */
exports.ProjectDepartment$outboundSchema = z.object({
    id: z.string().optional(),
    name: z.string().optional(),
});
function projectDepartmentToJSON(projectDepartment) {
    return JSON.stringify(exports.ProjectDepartment$outboundSchema.parse(projectDepartment));
}
function projectDepartmentFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ProjectDepartment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProjectDepartment' from JSON`);
}
/** @internal */
exports.ParentProject$inboundSchema = z.object({
    id: z.string().optional(),
    name: z.string().optional(),
});
/** @internal */
exports.ParentProject$outboundSchema = z.object({
    id: z.string().optional(),
    name: z.string().optional(),
});
function parentProjectToJSON(parentProject) {
    return JSON.stringify(exports.ParentProject$outboundSchema.parse(parentProject));
}
function parentProjectFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ParentProject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ParentProject' from JSON`);
}
/** @internal */
exports.BillingMethod$inboundSchema = z.nativeEnum(exports.BillingMethod);
/** @internal */
exports.BillingMethod$outboundSchema = exports.BillingMethod$inboundSchema;
/** @internal */
exports.ProjectPhase$inboundSchema = z.nativeEnum(exports.ProjectPhase);
/** @internal */
exports.ProjectPhase$outboundSchema = exports.ProjectPhase$inboundSchema;
/** @internal */
exports.ScheduleStatus$inboundSchema = z.nativeEnum(exports.ScheduleStatus);
/** @internal */
exports.ScheduleStatus$outboundSchema = exports.ScheduleStatus$inboundSchema;
/** @internal */
exports.Project$inboundSchema = z.object({
    id: z.string().optional(),
    downstream_id: z.nullable(z.string()).optional(),
    name: z.string(),
    display_id: z.nullable(z.string()).optional(),
    reference_id: z.nullable(z.string()).optional(),
    description: z.nullable(z.string()).optional(),
    status: z.nullable(exports.ProjectProjectStatus$inboundSchema).optional(),
    active: z.nullable(z.boolean()).optional(),
    project_type: z.nullable(exports.ProjectType$inboundSchema).optional(),
    priority: z.nullable(exports.Priority$inboundSchema).optional(),
    completion_percentage: z.nullable(z.number()).optional(),
    start_date: z.nullable(z.string().transform(v => new rfcdate_js_1.RFCDate(v)))
        .optional(),
    end_date: z.nullable(z.string().transform(v => new rfcdate_js_1.RFCDate(v))).optional(),
    customer: z.nullable(linkedcustomer_js_1.LinkedCustomer$inboundSchema).optional(),
    department: z.nullable(z.lazy(() => exports.ProjectDepartment$inboundSchema))
        .optional(),
    company_id: z.nullable(z.string()).optional(),
    owner_id: z.nullable(z.string()).optional(),
    parent_project: z.nullable(z.lazy(() => exports.ParentProject$inboundSchema))
        .optional(),
    currency: z.nullable(currency_js_1.Currency$inboundSchema).optional(),
    budget_amount: z.nullable(z.number()).optional(),
    approved_amount: z.nullable(z.number()).optional(),
    actual_amount: z.nullable(z.number()).optional(),
    budget_hours: z.nullable(z.number()).optional(),
    actual_hours: z.nullable(z.number()).optional(),
    hourly_rate: z.nullable(z.number()).optional(),
    billing_method: z.nullable(exports.BillingMethod$inboundSchema).optional(),
    is_billable: z.nullable(z.boolean().default(true)),
    phase: z.nullable(exports.ProjectPhase$inboundSchema).optional(),
    tax_rate: linkedtaxrate_js_1.LinkedTaxRate$inboundSchema.optional(),
    tracking_categories: z.nullable(z.array(z.nullable(linkedtrackingcategory_js_1.LinkedTrackingCategory$inboundSchema))).optional(),
    tags: z.array(z.string()).optional(),
    notes: z.nullable(z.string()).optional(),
    contract_number: z.nullable(z.string()).optional(),
    profit_margin: z.nullable(z.number()).optional(),
    schedule_status: z.nullable(exports.ScheduleStatus$inboundSchema).optional(),
    addresses: z.array(address_js_1.Address$inboundSchema).optional(),
    team_size: z.nullable(z.number().int()).optional(),
    custom_fields: z.array(customfield_js_1.CustomField$inboundSchema).optional(),
    row_version: z.nullable(z.string()).optional(),
    updated_by: z.nullable(z.string()).optional(),
    created_by: z.nullable(z.string()).optional(),
    created_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    updated_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "downstream_id": "downstreamId",
        "display_id": "displayId",
        "reference_id": "referenceId",
        "project_type": "projectType",
        "completion_percentage": "completionPercentage",
        "start_date": "startDate",
        "end_date": "endDate",
        "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",
    });
});
function projectFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Project$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Project' from JSON`);
}
/** @internal */
exports.ProjectInput$outboundSchema = 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(exports.ProjectProjectStatus$outboundSchema).optional(),
    active: z.nullable(z.boolean()).optional(),
    projectType: z.nullable(exports.ProjectType$outboundSchema).optional(),
    priority: z.nullable(exports.Priority$outboundSchema).optional(),
    completionPercentage: z.nullable(z.number()).optional(),
    startDate: z.nullable(z.instanceof(rfcdate_js_1.RFCDate).transform(v => v.toString()))
        .optional(),
    endDate: z.nullable(z.instanceof(rfcdate_js_1.RFCDate).transform(v => v.toString()))
        .optional(),
    customer: z.nullable(linkedcustomerinput_js_1.LinkedCustomerInput$outboundSchema).optional(),
    department: z.nullable(z.lazy(() => exports.ProjectDepartment$outboundSchema))
        .optional(),
    companyId: z.nullable(z.string()).optional(),
    ownerId: z.nullable(z.string()).optional(),
    parentProject: z.nullable(z.lazy(() => exports.ParentProject$outboundSchema))
        .optional(),
    currency: z.nullable(currency_js_1.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(exports.BillingMethod$outboundSchema).optional(),
    isBillable: z.nullable(z.boolean().default(true)),
    phase: z.nullable(exports.ProjectPhase$outboundSchema).optional(),
    taxRate: linkedtaxrateinput_js_1.LinkedTaxRateInput$outboundSchema.optional(),
    trackingCategories: z.nullable(z.array(z.nullable(linkedtrackingcategory_js_1.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(exports.ScheduleStatus$outboundSchema).optional(),
    addresses: z.array(address_js_1.Address$outboundSchema).optional(),
    teamSize: z.nullable(z.number().int()).optional(),
    customFields: z.array(customfield_js_1.CustomField$outboundSchema).optional(),
    rowVersion: z.nullable(z.string()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        displayId: "display_id",
        referenceId: "reference_id",
        projectType: "project_type",
        completionPercentage: "completion_percentage",
        startDate: "start_date",
        endDate: "end_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",
    });
});
function projectInputToJSON(projectInput) {
    return JSON.stringify(exports.ProjectInput$outboundSchema.parse(projectInput));
}
//# sourceMappingURL=project.js.map