{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pestprocrm-com/json-schema/pestprocrm-com-equipment-schema.json",
  "title": "Equipment",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pestprocrm-com-openapi.yml#/components/schemas/Equipment",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique equipment ID"
    },
    "assignedTo": {
      "type": "string",
      "description": "Technician ID equipment is assigned to"
    },
    "assignedToName": {
      "type": "string",
      "description": "Technician name"
    },
    "type": {
      "type": "string",
      "enum": [
        "sprayer",
        "bait_station",
        "trap",
        "vehicle",
        "other"
      ],
      "description": "Equipment type"
    },
    "model": {
      "type": "string",
      "description": "Equipment model"
    },
    "serialNumber": {
      "type": "string",
      "description": "Serial number"
    },
    "manufacturer": {
      "type": "string",
      "description": "Equipment manufacturer"
    },
    "purchaseDate": {
      "type": "string",
      "format": "date",
      "description": "Date of purchase"
    },
    "purchasePrice": {
      "type": "number",
      "description": "Purchase price"
    },
    "lastMaintenance": {
      "type": "string",
      "format": "date",
      "description": "Date of last maintenance"
    },
    "nextMaintenance": {
      "type": "string",
      "format": "date",
      "description": "Date of next scheduled maintenance"
    },
    "maintenanceHistory": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/MaintenanceRecord"
      },
      "description": "Maintenance history"
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "needs_repair",
        "retired"
      ],
      "description": "Equipment status"
    },
    "notes": {
      "type": "string",
      "description": "Equipment notes"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Created timestamp"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Updated timestamp"
    }
  },
  "required": [
    "id",
    "type"
  ],
  "$defs": {
    "MaintenanceRecord": {
      "type": "object",
      "properties": {
        "date": {
          "type": "string",
          "format": "date",
          "description": "Date of maintenance"
        },
        "type": {
          "type": "string",
          "description": "Type of maintenance performed"
        },
        "description": {
          "type": "string",
          "description": "Description of work done"
        },
        "cost": {
          "type": "number",
          "description": "Cost of maintenance"
        },
        "performedBy": {
          "type": "string",
          "description": "Who performed the maintenance"
        }
      }
    }
  }
}