{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/smarfle-com/json-schema/smarfle-com-invoice-schema.json",
  "title": "Invoice",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/smarfle-com-openapi.yml#/components/schemas/Invoice",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "object": {
      "const": "invoice"
    },
    "number": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "sent",
        "overdue",
        "paid"
      ]
    },
    "customer_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "job_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "subtotal": {
      "type": [
        "number",
        "null"
      ]
    },
    "tax_rate": {
      "type": [
        "number",
        "null"
      ]
    },
    "tax_amount": {
      "type": [
        "number",
        "null"
      ]
    },
    "discount_amount": {
      "type": [
        "number",
        "null"
      ]
    },
    "tip_amount": {
      "type": [
        "number",
        "null"
      ]
    },
    "total": {
      "type": [
        "number",
        "null"
      ]
    },
    "currency": {
      "const": "usd"
    },
    "due_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "paid_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "paid_method": {
      "type": [
        "string",
        "null"
      ]
    },
    "refund_amount": {
      "type": [
        "number",
        "null"
      ]
    },
    "refunded_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "type": [
              "number",
              "null"
            ]
          },
          "unit_price": {
            "type": [
              "number",
              "null"
            ]
          },
          "total": {
            "type": [
              "number",
              "null"
            ]
          },
          "service_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  }
}