{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/gupy/json-schema/gupy-job-offer-schema.json",
  "title": "jobOffer",
  "description": "Job offer resource",
  "x-generated": "2026-12-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/gupy-public-api-openapi.yml#/components/schemas/jobOffer",
  "type": "object",
  "properties": {
    "id": {
      "description": "Job offer ID",
      "type": "integer",
      "format": "int64"
    },
    "jobId": {
      "description": "Job ID",
      "type": "integer",
      "format": "int64"
    },
    "applicationId": {
      "description": "Application ID",
      "type": "integer",
      "format": "int64"
    },
    "status": {
      "description": "Job offer status",
      "type": "string",
      "maxLength": 32,
      "enum": [
        "NOT_SENT",
        "SENT",
        "VIEWED",
        "ACCEPTED",
        "REJECTED",
        "CANCELED"
      ]
    },
    "sentAt": {
      "description": "Date when the offer was sent",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "answeredAt": {
      "description": "Date when the candidate answered the offer",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "rejectReason": {
      "description": "Reason provided when the offer was rejected",
      "type": [
        "string",
        "null"
      ],
      "maxLength": 1073741824
    },
    "salaryAmount": {
      "description": "Proposed salary amount",
      "type": "number",
      "format": "double"
    },
    "salaryCurrency": {
      "description": "Salary currency symbol",
      "type": "string",
      "maxLength": 16
    },
    "admissionDate": {
      "description": "Planned admission date",
      "type": "string",
      "format": "date-time"
    },
    "admissionType": {
      "description": "Hiring type",
      "type": "string",
      "maxLength": 32,
      "enum": [
        "employee_admission",
        "employee_readmission",
        "employee_reintegration",
        "unrelated_worker_hiring",
        "internal_transfer"
      ]
    },
    "templateId": {
      "description": "Email template ID used as the offer body source",
      "type": "integer",
      "format": "int64"
    },
    "body": {
      "description": "Job offer body content with resolved placeholders",
      "type": "string",
      "maxLength": 1073741824
    },
    "createdAt": {
      "description": "Creation date",
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "description": "Last update date",
      "type": "string",
      "format": "date-time"
    },
    "createdBy": {
      "description": "Name of the user who created the offer",
      "type": [
        "string",
        "null"
      ],
      "maxLength": 255
    },
    "candidatePortalUrl": {
      "description": "Candidate portal URL for the offer. Null when status is NOT_SENT or CANCELED.",
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "maxLength": 2048
    },
    "deliveries": {
      "description": "Delivery history for this job offer, ordered by createdAt ascending",
      "type": "array",
      "items": {
        "$ref": "#/$defs/jobOfferDelivery"
      }
    }
  },
  "required": [
    "id",
    "jobId",
    "applicationId",
    "status",
    "salaryAmount",
    "salaryCurrency",
    "admissionDate",
    "admissionType",
    "templateId",
    "body",
    "createdAt",
    "updatedAt",
    "deliveries"
  ],
  "$defs": {
    "jobOfferDelivery": {
      "type": "object",
      "description": "A single delivery attempt for a job offer",
      "properties": {
        "id": {
          "description": "Delivery ID",
          "type": "integer",
          "format": "int64"
        },
        "channel": {
          "description": "Delivery channel",
          "type": "string",
          "maxLength": 32,
          "enum": [
            "email",
            "whatsapp",
            "integration"
          ]
        },
        "status": {
          "description": "Delivery status. Internal PROCESSING (worker claim) is exposed as SENDING.",
          "type": "string",
          "maxLength": 32,
          "enum": [
            "SENDING",
            "SENT",
            "SEND_FAILED",
            "INVALID_RECIPIENT"
          ]
        },
        "sentAt": {
          "description": "Date when this delivery was successfully sent. Null while sending or on failure.",
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "createdAt": {
          "description": "Delivery record creation date",
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "id",
        "channel",
        "status",
        "sentAt",
        "createdAt"
      ]
    }
  }
}