{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://trackingpremium.local/maincompany/bootstrap.schema.json",
  "title": "Maincompany Bootstrap Input",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "company",
    "masterAgency",
    "adminUser",
    "countries"
  ],
  "properties": {
    "company": {
      "type": "object",
      "additionalProperties": true,
      "required": ["name", "acronym", "email"],
      "properties": {
        "name": { "type": "string", "minLength": 2 },
        "acronym": { "type": "string", "minLength": 2, "maxLength": 20 },
        "email": { "type": "string", "format": "email" },
        "url": { "type": "string" },
        "homepage": { "type": "string" },
        "dimFactor": { "type": "number" },
        "convertVol": { "type": "number" },
        "logo": { "type": "string" },
        "correlatives": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "byAgency": { "type": "boolean" },
            "documentSequences": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "hawb": { "$ref": "#/$defs/documentSequenceConfig" },
                "expense": { "$ref": "#/$defs/documentSequenceConfig" },
                "warehouse": { "$ref": "#/$defs/documentSequenceConfig" },
                "package": { "$ref": "#/$defs/documentSequenceConfig" },
                "shipment": { "$ref": "#/$defs/documentSequenceConfig" },
                "pickup": { "$ref": "#/$defs/documentSequenceConfig" },
                "repackrequest": { "$ref": "#/$defs/documentSequenceConfig" },
                "listpickup": { "$ref": "#/$defs/documentSequenceConfig" },
                "alert": { "$ref": "#/$defs/documentSequenceConfig" },
                "loadunit": { "$ref": "#/$defs/documentSequenceConfig" },
                "shippingrequest": { "$ref": "#/$defs/documentSequenceConfig" },
                "customer": { "$ref": "#/$defs/documentSequenceConfig" },
                "consolidated": { "$ref": "#/$defs/documentSequenceConfig" },
                "pobox": { "$ref": "#/$defs/documentSequenceConfig" },
                "invoice": { "$ref": "#/$defs/documentSequenceConfig" },
                "payment": { "$ref": "#/$defs/documentSequenceConfig" },
                "multipayment": { "$ref": "#/$defs/documentSequenceConfig" },
                "route": { "$ref": "#/$defs/documentSequenceConfig" },
                "deliverylist": { "$ref": "#/$defs/documentSequenceConfig" },
                "quote": { "$ref": "#/$defs/documentSequenceConfig" },
                "hbl": { "$ref": "#/$defs/documentSequenceConfig" },
                "mbl": { "$ref": "#/$defs/documentSequenceConfig" }
              }
            }
          }
        }
      }
    },
    "masterAgency": {
      "type": "object",
      "additionalProperties": true,
      "required": ["name", "email", "address", "cityId"],
      "properties": {
        "name": { "type": "string" },
        "email": { "type": "string", "format": "email" },
        "address": { "type": "string" },
        "cityId": { "type": "integer", "minimum": 1 },
        "zip": { "type": "string" },
        "phone": { "type": "string" }
      }
    },
    "adminUser": {
      "type": "object",
      "additionalProperties": true,
      "required": ["username", "email", "name", "lastname", "password"],
      "properties": {
        "username": { "type": "string", "minLength": 3 },
        "email": { "type": "string", "format": "email" },
        "name": { "type": "string" },
        "lastname": { "type": "string" },
        "password": { "type": "string", "minLength": 8 },
        "statusId": { "type": "integer", "minimum": 1 }
      }
    },
    "technicalUser": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "username": { "type": "string" },
        "email": { "type": "string", "format": "email" },
        "name": { "type": "string" },
        "lastname": { "type": "string" },
        "password": { "type": "string" },
        "statusId": { "type": "integer", "minimum": 1 }
      }
    },
    "plan": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": { "type": "integer", "minimum": 1 }
      }
    },
    "countries": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id"],
        "properties": {
          "id": { "type": "integer", "minimum": 1 }
        }
      }
    },
    "defaults": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "seedDefaults": { "type": "boolean" },
        "templateMaincompanyId": { "type": "integer", "minimum": 0 }
      }
    }
  },
  "$defs": {
    "documentSequenceConfig": {
      "type": "object",
      "additionalProperties": false,
      "required": ["prefix", "initial"],
      "properties": {
        "prefix": { "type": "string", "minLength": 1 },
        "initial": { "type": "integer", "minimum": 1 }
      }
    }
  }
}
