{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/assetlab-ca/json-schema/assetlab-ca-asset-cost-schema.json",
  "title": "AssetCost",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/assetlab-ca-asset-costs-api-openapi.yml#/components/schemas/AssetCost",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "asset_id": {
      "type": "string",
      "format": "uuid"
    },
    "site_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "building_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "category": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "Acquisition",
        "Repair",
        "PM",
        "Operation",
        "Replacement",
        "Decommission",
        "Other"
      ]
    },
    "amount": {
      "type": "number",
      "description": "Money in the organization's currency - GET /v1/organization-settings for currency_code"
    },
    "cost_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "invoice_number": {
      "type": [
        "string",
        "null"
      ]
    },
    "po_number": {
      "type": [
        "string",
        "null"
      ]
    },
    "purchase_order_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Purchase order (see /purchase-orders) that paid this cost. Counts against the order's remaining balance unless the cost belongs to a work order, whose own purchase_order_id counts it; null clears it. po_number stays for order numbers typed as free text."
    },
    "vendor_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Vendor (see /vendors) this cost was paid to; null clears it."
    },
    "work_order_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "work_order_number": {
      "type": [
        "integer",
        "null"
      ]
    },
    "created_by": {
      "type": [
        "string",
        "null"
      ],
      "description": "Clerk user ID"
    },
    "created_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "updated_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "asset": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "sites": {
      "$ref": "#/$defs/SiteRef"
    },
    "buildings": {
      "$ref": "#/$defs/BuildingRef"
    },
    "vendors": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        }
      }
    }
  },
  "$defs": {
    "BuildingRef": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "SiteRef": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        }
      }
    }
  }
}