{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.cheapgpu.com/specs/endpoint-v1-draft/schemas/endpoint.schema.json",
  "$comment": "Draft only. Structural validation does not establish safety, authenticity, availability, or billability.",
  "type": "object",
  "properties": {
    "contract_version": {
      "const": "cheapgpu.endpoint.v1-draft.4"
    },
    "endpoint_id": {
      "$ref": "common.schema.json#/$defs/id"
    },
    "supplier_id": {
      "$ref": "common.schema.json#/$defs/id"
    },
    "configuration_revision": {
      "$ref": "common.schema.json#/$defs/positive_decimal"
    },
    "enabled": {
      "type": "boolean"
    },
    "inference_url": {
      "type": "string",
      "maxLength": 2048,
      "pattern": "^https://(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?::443)?(?:/[A-Za-z0-9._~!$&'()*+,;=:@%/-]*)?$",
      "description": "Syntax only. Public DNS/IP, actual connection, TLS and egress checks are mandatory separately."
    },
    "authentication": {
      "const": "bearer"
    },
    "credential_binding_id": {
      "$ref": "common.schema.json#/$defs/id"
    },
    "bindings": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "properties": {
          "model_id": {
            "$ref": "common.schema.json#/$defs/model_id"
          },
          "model_revision": {
            "$ref": "common.schema.json#/$defs/model_revision"
          },
          "supplier_model_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "profile_id": {
            "$ref": "common.schema.json#/$defs/profile_id"
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "model_id",
          "model_revision",
          "supplier_model_id",
          "profile_id",
          "capabilities"
        ],
        "additionalProperties": false,
        "allOf": [
          {
            "$ref": "common.schema.json#/$defs/profile_binding"
          }
        ]
      }
    }
  },
  "required": [
    "contract_version",
    "endpoint_id",
    "supplier_id",
    "configuration_revision",
    "enabled",
    "inference_url",
    "authentication",
    "credential_binding_id",
    "bindings"
  ],
  "additionalProperties": false
}
