{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/telenor-sverige/json-schema/telenor-sverige-create-site-request-v2-schema.json",
  "title": "CreateSiteRequestV2",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/telenor-sverige-geographic-sites-management-openapi.yml#/components/schemas/CreateSiteRequestV2",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "A name of the site such as a denoted name of the project site. Will be prefixed with company name.",
      "maxLength": 120,
      "minLength": 0
    },
    "externalId": {
      "type": "string",
      "description": "The ID of the site that's generated and stored in a client's system.",
      "maxLength": 80,
      "minLength": 0
    },
    "address": {
      "$ref": "#/$defs/AddressRequestV2",
      "description": "The address given to the site. Required if the site is not movable."
    },
    "rt90Coordinates": {
      "$ref": "#/$defs/Rt90CoordinatesDto",
      "description": "The geographical location of the site expressed in RT 90 Coordinates."
    },
    "movable": {
      "type": "boolean",
      "description": "If true, the site is considered movable and address and rt90Coordinates must not be set. Site name is required. Defaults to false"
    },
    "contactPersons": {
      "type": "array",
      "description": "The contact persons related to the site.",
      "items": {
        "$ref": "#/$defs/CreateSiteContactV2"
      },
      "minItems": 1
    }
  },
  "required": [
    "contactPersons"
  ],
  "$defs": {
    "AddressRequestV2": {
      "type": "object",
      "properties": {
        "streetName": {
          "type": "string",
          "description": "The street name.",
          "maxLength": 100,
          "minLength": 0
        },
        "streetNumber": {
          "type": "string",
          "description": "The street number, including any entrance designation letters. Any excessive whitespace, such as between digits and letters, will be trimmed.",
          "maxLength": 20,
          "minLength": 0
        },
        "apartmentNumber": {
          "type": "string",
          "description": "The apartment number for the address.",
          "maxLength": 20,
          "minLength": 0
        },
        "postalCode": {
          "type": "string",
          "description": "The postal code of the address.",
          "maxLength": 20,
          "minLength": 0
        },
        "city": {
          "type": "string",
          "description": "The city of the address.",
          "maxLength": 40,
          "minLength": 0
        },
        "country": {
          "type": "string",
          "description": "The country of the address in English. Non-English names may be translated.",
          "maxLength": 40,
          "minLength": 0
        }
      },
      "required": [
        "city",
        "country",
        "postalCode",
        "streetName"
      ]
    },
    "CreateSiteContactV2": {
      "type": "object",
      "properties": {
        "role": {
          "type": "string",
          "description": "The role of the contact person.",
          "enum": [
            "LOCAL_CONTACT",
            "TECHNICAL",
            "PLANNED_WORK",
            "ALARM_CONTACT"
          ]
        },
        "firstName": {
          "type": "string",
          "description": "The first name of the contact person.",
          "maxLength": 30,
          "minLength": 0
        },
        "lastName": {
          "type": "string",
          "description": "The last name of the contact person.",
          "maxLength": 30,
          "minLength": 0
        },
        "email": {
          "type": "string",
          "format": "email",
          "description": "The e-mail name of the contact person.",
          "maxLength": 320,
          "minLength": 0
        },
        "phoneNumber": {
          "type": "string",
          "description": "The phone number of the contact person. If missing the value of 'mobileNumber' will be used. Phone number should consist only of digits, spaces, dashes with optional leading plus. ",
          "maxLength": 20,
          "minLength": 0
        },
        "mobileNumber": {
          "type": "string",
          "description": "The mobile number of the contact person. Phone number should consist only of digits, spaces, dashes with optional leading plus. ",
          "maxLength": 20,
          "minLength": 0
        }
      },
      "required": [
        "email",
        "firstName",
        "mobileNumber",
        "role"
      ]
    },
    "Rt90CoordinatesDto": {
      "type": "object",
      "properties": {
        "rt90X": {
          "type": "integer",
          "format": "int32"
        },
        "rt90Y": {
          "type": "integer",
          "format": "int32"
        }
      },
      "required": [
        "rt90X",
        "rt90Y"
      ]
    }
  }
}