{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/acculynx/json-schema/acculynx-job-schema.json",
  "title": "job",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/acculynx-api-v2-api-openapi.yml#/components/schemas/job",
  "allOf": [
    {
      "$ref": "#/$defs/jobLink"
    },
    {
      "type": "object",
      "properties": {
        "contacts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/jobContact"
          },
          "description": "The contacts linked to this job, including relationship metadata for each entry. By default, the nested contact object contains only an ID and link reference. Specify `contact` in the `includes` query parameter to expand each nested contact with its full profile (name, phone numbers, and email addresses).\n"
        },
        "locationAddress": {
          "$ref": "#/$defs/address",
          "description": "The physical address of the job location."
        },
        "geoLocation": {
          "$ref": "#/$defs/geoLocation",
          "description": "The geographic coordinates derived from the job location address."
        },
        "tradeTypes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/tradeType"
          },
          "description": "The trade types assigned to this job."
        },
        "jobCategory": {
          "$ref": "#/$defs/jobCategory",
          "description": "The job category assigned to this job, as configured in company settings."
        },
        "workType": {
          "$ref": "#/$defs/workType",
          "description": "The work type assigned to this job, as configured in company settings."
        },
        "leadSource": {
          "$ref": "#/$defs/leadSource",
          "description": "The lead source that identifies how this job was originated."
        },
        "initialAppointment": {
          "$ref": "#/$defs/initialAppointmentLink",
          "description": "A link reference to the initial appointment scheduled for this job, if one exists."
        },
        "leadDeadReason": {
          "$ref": "#/$defs/leadDeadReason",
          "description": "The reason this job was marked as dead, if applicable."
        },
        "milestoneDate": {
          "type": "string",
          "format": "date-time",
          "description": "The date/time when the job entered its current milestone."
        },
        "createdDate": {
          "type": "string",
          "format": "date-time",
          "description": "The date/time when this job was created."
        },
        "modifiedDate": {
          "type": "string",
          "format": "date-time",
          "description": "The date and time when this job was last modified."
        },
        "currentMilestone": {
          "type": "string",
          "description": "The job's current workflow milestone.",
          "enum": [
            "Lead",
            "Prospect",
            "Approved",
            "Completed",
            "Invoiced",
            "Closed",
            "Cancelled"
          ]
        },
        "jobNumber": {
          "type": "string",
          "description": "The human-readable reference number for this job. The format is configured in company settings."
        },
        "jobName": {
          "type": "string",
          "description": "The full name for this job."
        },
        "priority": {
          "type": "string",
          "description": "The priority level assigned to this job.",
          "enum": [
            "Normal",
            "High",
            "Urgent"
          ]
        }
      }
    }
  ],
  "$defs": {
    "address": {
      "type": "object",
      "properties": {
        "street1": {
          "type": "string"
        },
        "street2": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "state": {
          "$ref": "#/$defs/state"
        },
        "zipCode": {
          "type": "string"
        },
        "country": {
          "$ref": "#/$defs/country"
        }
      }
    },
    "contact": {
      "allOf": [
        {
          "$ref": "#/$defs/contactLink"
        },
        {
          "type": "object",
          "properties": {
            "firstName": {
              "type": "string",
              "description": "First name of the contact."
            },
            "lastName": {
              "type": "string",
              "description": "Last name of the contact."
            },
            "salutation": {
              "type": "string",
              "description": "Salutation of the contact."
            },
            "crossReference": {
              "type": "string",
              "description": "CrossReference of the contact."
            },
            "companyName": {
              "type": "string",
              "description": "CompanyName of the contact."
            },
            "phoneNumbers": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/phoneNumberLink"
              }
            },
            "emailAddresses": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/emailAddressLink"
              }
            },
            "mailingAddress": {
              "$ref": "#/$defs/address"
            },
            "billingAddress": {
              "$ref": "#/$defs/address"
            },
            "createdDate": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time",
              "description": "Date the contact was created, in ISO 8601 format. Null when unavailable."
            },
            "modifiedDate": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time",
              "description": "Date the contact was last modified, in ISO 8601 format. Null when unavailable."
            }
          }
        }
      ]
    },
    "contactLink": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The unique GUID identifying this contact.",
          "format": "uuid"
        },
        "_link": {
          "type": "string",
          "description": "The unique URI for this resource."
        }
      }
    },
    "country": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "The id for the Country."
        },
        "name": {
          "type": "string",
          "description": "The name of the Country."
        },
        "abbreviation": {
          "type": "string",
          "description": "The 2 character abbreviation for the Country.",
          "minLength": 2,
          "maxLength": 2
        },
        "_link": {
          "type": "string",
          "description": "The URI of the Country."
        }
      }
    },
    "emailAddressLink": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The GUID of the Email Address.",
          "format": "uuid",
          "readOnly": true
        },
        "_link": {
          "type": "string",
          "description": "The URI of the Email Address",
          "readOnly": true
        }
      }
    },
    "geoLocation": {
      "type": "object",
      "properties": {
        "latitude": {
          "type": "number",
          "description": "latitude component of the map location"
        },
        "longitude": {
          "type": "number",
          "description": "longitude component of the map location"
        }
      }
    },
    "initialAppointmentLink": {
      "type": "object",
      "properties": {
        "_link": {
          "type": "string",
          "description": "The unique URI of the Initial Apppointment for the specified Job."
        }
      }
    },
    "jobCategory": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "The category's unique identifier."
        },
        "name": {
          "type": "string",
          "description": "The category's name."
        }
      }
    },
    "jobContact": {
      "allOf": [
        {
          "$ref": "#/$defs/jobContactLink"
        },
        {
          "type": "object",
          "properties": {
            "isPrimary": {
              "type": "boolean",
              "description": "Is this the primary contact for this job?"
            },
            "relationToPrimary": {
              "type": "string",
              "description": "how is this contact related to the primary contact?"
            },
            "contact": {
              "description": "ContactLink object is included by default. Specify includes=contact in the request to include the full Contact object.",
              "oneOf": [
                {
                  "$ref": "#/$defs/contact"
                },
                {
                  "$ref": "#/$defs/contactLink"
                }
              ]
            }
          }
        }
      ]
    },
    "jobContactLink": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "The contact's unique ID."
        },
        "_link": {
          "type": "string",
          "description": "The URI of this contact."
        }
      }
    },
    "jobLink": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "The job's unique ID."
        },
        "_link": {
          "type": "string",
          "description": "The URI of this Job."
        }
      }
    },
    "leadDeadReason": {
      "type": "string",
      "description": "The reason why the lead was marked as dead."
    },
    "leadSource": {
      "allOf": [
        {
          "$ref": "#/$defs/leadSourceLink"
        },
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "children": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "$ref": "#/$defs/leadSourceChild"
              }
            }
          }
        }
      ]
    },
    "leadSourceChild": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        },
        "parentId": {
          "type": "string",
          "format": "uuid"
        },
        "_link": {
          "type": "string",
          "description": "The URI of the LeadSource."
        }
      }
    },
    "leadSourceLink": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "_link": {
          "type": "string",
          "description": "The URI of the LeadSource."
        }
      }
    },
    "phoneNumberLink": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The GUID of the Phone Number.",
          "format": "uuid",
          "readOnly": true
        },
        "_link": {
          "type": "string",
          "description": "The URI of the Phone Number.",
          "readOnly": true
        }
      }
    },
    "state": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "The id for the state."
        },
        "name": {
          "type": "string",
          "description": "The name of the State."
        },
        "abbreviation": {
          "type": "string",
          "description": "The 2 character abbreviation for the State.",
          "minLength": 2,
          "maxLength": 2
        },
        "_link": {
          "type": "string",
          "description": "The URI of the State."
        }
      }
    },
    "tradeType": {
      "type": "object",
      "properties": {
        "tradeId": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "description": "The name of the Trade.",
          "type": "string"
        }
      }
    },
    "workType": {
      "allOf": [
        {
          "$ref": "#/$defs/workTypeLink"
        },
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "The name of the Work Type."
            },
            "systemDefault": {
              "type": "boolean",
              "description": "Shows if the work type is a System Default item."
            }
          }
        }
      ]
    },
    "workTypeLink": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "The Work Type unique identifier."
        },
        "_link": {
          "type": "string",
          "description": "The URI of the Work Type."
        }
      }
    }
  }
}