{

"components": {
  "schemas": {
    "request": {
      "post": {
        "type": "object",
        "xml": { "name": "/" },
        "properties": {
          "purchase_order": {
            "type": "object",
            "required": ["name", "vendor"],
            "properties": { "$ref": "purchase_order.json#/components/schemas/request_properties" }
          }
        }
      },
      "put": {
        "type": "object",
        "xml": { "name": "/" },
        "properties": {
          "purchase_order": {
            "type": "object",
            "properties": { "$ref": "purchase_order.json#/components/schemas/request_properties" }
          }
        }
      }
    },
    "request_properties": {
      "name": { "type": "string", "example": "Purchase order Name" },
      "buyer_id": { "$ref": "../../components.json#/components/common/schemas/association_by_id" },
      "buyer": { "$ref": "../../components.json#/components/request/schemas/association_by_email" },
      "order_date": { "type": "string", "example": "Jan 01, 2025" },
      "due_date": { "type": "string", "example": "Jan 01, 2030" },
      "site": { "$ref": "../../components.json#/components/request/schemas/association_by_name" },
      "department": { "$ref": "../../components.json#/components/request/schemas/association_by_name" },
      "state": { "type": "string", "example": "Approved" },
      "requester": { "$ref": "../../components.json#/components/request/schemas/association_by_email" },
      "recurrence": { "type": "string", "example": "Monthly" },
      "total_cost": { "$ref": "../../components.json#/components/common/schemas/number_or_string" },
      "currency": { "type": "string", "example": "USD" },
      "tax": { "$ref": "../../components.json#/components/common/schemas/number_or_string" },
      "notes": { "type": "string", "example": "Purchase notes" },
      "vendor": { "$ref": "../../components.json#/components/request/schemas/association_by_name" },
      "billing_address": { "type": "string", "example": "Billing address" },
      "shipping_address": { "type": "string", "example": "Shipping address" },
      "payment_terms": { "type": "string", "example": "Purchase terms" },
      "terms_conditions": { "type": "string", "example": "Terms conditions" },
      "custom_fields_values": { "$ref": "../../components.json#/components/request/schemas/custom_fields_values" },
      "custom_fields_values_attributes": { "$ref": "../../components.json#/components/request/schemas/custom_fields_values_attributes" },
      "approval_levels_attributes": { "$ref": "../../components.json#/components/request/schemas/approval_levels_attributes" },
      "purchase_order_items_attributes": { "$ref": "../../components.json#/components/request/schemas/purchase_order_items_attributes" }
    },
    "response": {
      "type": "object",
      "xml": { "name": "/", "wrapped": true },
      "properties": {
        "purchase_order": {
          "type": "object",
          "properties": {
            "id": { "$ref": "../../components.json#/components/response/schemas/id" },
            "name": { "type": "string", "example": "Purchase order Name" },
            "order_date": { "type": "string", "example": "2025-01-01T00:00:00.000+01:00" },
            "due_date": { "type": "string", "example": "2030-01-01T00:00:00.000+01:00" },
            "buyer": { "$ref": "../../components.json#/components/response/schemas/id_name_href" },
            "site": { "$ref": "../../components.json#/components/response/schemas/id_name_href" },
            "department": { "$ref": "../../components.json#/components/response/schemas/id_name_href" },
            "state": { "type": "string", "example": "Approved" },
            "requester": { "$ref": "../../components.json#/components/response/schemas/id_name_href", "example": { "id": "1", "name": "John Doe", "href": "/users/1" } },
            "recurrence": { "type": "string", "example": "Monthly" },
            "total_cost": { "type": "string", "example": "1" },
            "currency": { "type": "string", "example": "USD" },
            "notes": { "type": "string", "example": "Purchase notes" },
            "vendor": { "$ref": "../../components.json#/components/response/schemas/id_name_href" },
            "billing_address": { "type": "string", "example": "Billing address" },
            "shipping_address": { "type": "string", "example": "Shipping address" },
            "payment_terms": { "type": "string", "example": "Purchase terms" },
            "terms_conditions": { "type": "string", "example": "Terms conditions" },
            "custom_fields_values": { "$ref": "../../components.json#/components/response/schemas/custom_fields_values" },
            "purchase_order_items": { "$ref": "../../components.json#/components/response/schemas/purchase_order_items" }
          }
        }
      }
    }
  }
}

}