{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/hint-health/main/json-schema/hint-health-provider-charges-controller-create-body-schema.json",
  "title": "Provider.ChargesController.create_body",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hint-health-charge-api-openapi.yml#/components/schemas/Provider.ChargesController.create_body",
  "type": "object",
  "properties": {
    "charge_item": {
      "$ref": "#/$defs/ChargeItem"
    },
    "patient": {
      "$ref": "#/$defs/Association"
    },
    "quantity": {
      "type": "integer",
      "format": "int32"
    },
    "price_in_cents": {
      "type": "number",
      "format": "double"
    },
    "description": {
      "type": "string"
    },
    "date": {
      "type": "string",
      "format": "date"
    },
    "category": {
      "$ref": "#/$defs/Category"
    },
    "practitioner": {
      "$ref": "#/$defs/Association"
    },
    "location": {
      "$ref": "#/$defs/Association"
    }
  },
  "required": [
    "charge_item",
    "patient"
  ],
  "$defs": {
    "Association": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        }
      },
      "required": [
        "id"
      ]
    },
    "Category": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Optional if type is specified"
        },
        "type": {
          "type": "string",
          "description": "Ignored if ID is specified",
          "enum": [
            "memberships",
            "labs",
            "medications",
            "vitamins_and_supplements",
            "vaccines",
            "imaging",
            "supplies_and_dme",
            "retail_items",
            "office_visits",
            "procedures",
            "fees"
          ]
        }
      },
      "required": [
        "id",
        "type"
      ]
    },
    "ChargeItem": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Optional if name, code and code_type are specified"
        },
        "name": {
          "type": "string",
          "description": "Required if no ID"
        },
        "code": {
          "type": "string",
          "description": "Required if no ID"
        },
        "code_type": {
          "type": "string",
          "description": "Required if no ID",
          "enum": [
            "cpt",
            "ndc",
            "loinc",
            "snowmed"
          ]
        },
        "manufacturer": {
          "type": "string"
        },
        "days_supply": {
          "type": "integer"
        }
      },
      "required": [
        "id",
        "name",
        "code",
        "code_type"
      ]
    }
  }
}