{
  "$schema": "http://json-schema.org/draft-04/hyper-schema",
  "title": "TME Dealer Finder - Access Control Domain Outlet Schema",
  "description": "this schema describes an outlet in the access control domain in the Toyota Motor Europe dealer network",
  "id": "https://a2d-api.toyota-europe.com/docs/dealer-schema-v5-access-control/schema.json",
  "type": "object",
  "required": ["uuid", "outlet", "lastModificationDate"],
  "properties": {
    "uuid": {
      "$ref": "#/definitions/uuid"
    },
    "outlet": {
      "description": "The relevant outlet data for the access control domain",
      "type": "object",
      "required": ["uuid", "name", "status", "brand"],
      "properties": {
        "uuid": {
          "$ref": "#/definitions/uuid"
        },
        "name": {
          "description": "The name of the outlet",
          "type": "string"
        },
        "status": {
          "$ref": "#/definitions/status"
        },
        "nmsc": {
          "description": "The nmsc code of the outlet",
          "type": "string",
          "enum": [
            "TAU",
            "TCA",
            "TBEL",
            "TBU",
            "TCH",
            "TCY",
            "TMCZ",
            "TDG",
            "TDK",
            "TBA",
            "TES",
            "LES",
            "TFO",
            "TFR",
            "TGB",
            "TGR",
            "THU",
            "TIR",
            "TIL",
            "TIC",
            "TMI",
            "TMKZ",
            "TNL",
            "TNO",
            "TPL",
            "TPO",
            "TRO",
            "TMR",
            "TSW",
            "TSK",
            "TTK",
            "TZA",
            "TUK",
            "TCI",
            "TAD"
          ]
        },
        "brand": {
          "description": "The brand of the outlet",
          "type": "string",
          "enum": ["Toyota", "Lexus"]
        },
        "codes": {
          "description": "the codes mapping for the outlet",
          "type": "object",
          "required": ["localDealerCode"],
          "properties": {
            "localDealerCode": {
              "description": "The local dealer code that is linked to the outlet"
            }
          }
        }
      }
    },
    "managingCompany": {
      "description": "The managing company of this outlet",
      "type": "object",
      "required": ["uuid", "status", "brand"],
      "properties": {
        "uuid": {
          "description": "The unique identifier of the managing company.",
          "type": "string"
        },
        "status": {
          "description": "Whether this managing company is currently active or inactive",
          "type": ["string"],
          "enum": ["Open", "Closed"]
        },
        "brand": {
          "description": "The brand of the managing company",
          "type": "string",
          "enum": ["Toyota", "Lexus"]
        }
      }
    },
    "holding": {
      "description": "The holding of this outlet",
      "type": "object",
      "required": ["uuid", "status"],
      "properties": {
        "uuid": {
          "description": "The unique identifier of the holding.",
          "type": "string"
        },
        "status": {
          "description": "Whether this holding is currently active or inactive",
          "type": ["string"],
          "enum": ["Open", "Closed"]
        }
      }
    },
    "lastModificationDate": {
      "description": "Timestamp of the last modification to this outlet",
      "type": "string",
      "pattern": "^[0-3][0-9]\/[0-1][0-9]\/[1-9][0-9]{3} [0-2][0-9]:[0-5][0-9]:[0-5][0-9].[0-9]{3}$"
    }
  },
  "definitions": {
    "uuid": {
      "description": "The unique identifier of the outlet. This value should be used to identify a dealer.",
      "type": "string"
    },
    "status": {
      "description": "Whether this outlet is currently active or inactive (= not an official outlet)",
      "type": ["string"],
      "enum": ["Open", "Closed"]
    }
  }
}
