{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ivans/json-schema/ivans-market-configuration-schema.json",
  "title": "MarketConfiguration",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ivans-market-configurations-api-openapi.yml#/components/schemas/MarketConfiguration",
  "type": "object",
  "properties": {
    "market": {
      "$ref": "#/$defs/MarketNested"
    },
    "allowedLinesOfBusiness": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/LineOfBusiness"
      }
    },
    "accessStructures": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/StructureAccess"
      }
    },
    "agency": {
      "$ref": "#/$defs/AgencyTenantDetail"
    },
    "uuid": {
      "type": "string",
      "format": "uuid",
      "readOnly": true
    },
    "appointed": {
      "type": "boolean"
    },
    "preferred": {
      "type": "boolean"
    },
    "notes": {
      "type": "string"
    }
  },
  "required": [
    "accessStructures",
    "agency",
    "allowedLinesOfBusiness",
    "market",
    "uuid"
  ],
  "$defs": {
    "AgencyTenantDetail": {
      "type": "object",
      "description": "Serializer for retrieving agency information.",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "readOnly": true,
          "description": "The unique ID for the agency."
        },
        "externalId": {
          "type": "string",
          "readOnly": true,
          "description": "The integrator's ID for the agency."
        },
        "npn": {
          "type": "string",
          "readOnly": true,
          "description": "The NPN of the agency."
        },
        "name": {
          "type": "string",
          "readOnly": true,
          "description": "The name of the agency."
        },
        "isActive": {
          "type": "boolean",
          "readOnly": true,
          "description": "Whether the agency is active."
        },
        "testMode": {
          "type": "boolean",
          "readOnly": true,
          "description": "Whether the agency is in test mode. In test mode, submissions for this agency will not be sent to the carrier, and a placeholder quote will be returned instead."
        }
      },
      "required": [
        "externalId",
        "id",
        "isActive",
        "name",
        "npn",
        "testMode"
      ]
    },
    "LineOfBusiness": {
      "type": "object",
      "properties": {
        "uuid": {
          "type": "string",
          "format": "uuid",
          "readOnly": true
        },
        "name": {
          "type": "string",
          "maxLength": 128
        },
        "code": {
          "type": "string",
          "maxLength": 32
        }
      },
      "required": [
        "code",
        "name",
        "uuid"
      ]
    },
    "MarketNested": {
      "type": "object",
      "properties": {
        "uuid": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string",
          "maxLength": 128
        },
        "displayName": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 128
        },
        "logo": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "pattern": "(?:png|jpg|svg|jpeg)$"
        },
        "availableLinesOfBusiness": {
          "allOf": [
            {
              "$ref": "#/$defs/LineOfBusiness"
            }
          ],
          "readOnly": true
        }
      },
      "required": [
        "availableLinesOfBusiness",
        "name"
      ]
    },
    "StructureAccess": {
      "type": "object",
      "properties": {
        "agency": {
          "$ref": "#/$defs/StructureChild"
        },
        "branch": {
          "$ref": "#/$defs/StructureChild"
        },
        "department": {
          "$ref": "#/$defs/StructureChild"
        },
        "businessUnit": {
          "$ref": "#/$defs/StructureChild"
        }
      },
      "required": [
        "agency",
        "branch",
        "businessUnit",
        "department"
      ]
    },
    "StructureChild": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "code": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "id",
        "name"
      ]
    }
  }
}