{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/telenor-sverige/json-schema/telenor-sverige-quote-group-dto-schema.json",
  "title": "QuoteGroupDto",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/telenor-sverige-fixed-network-quotation-openapi.yml#/components/schemas/QuoteGroupDto",
  "type": "object",
  "required": [
    "site"
  ],
  "properties": {
    "externalQuoteGroupId": {
      "type": "string",
      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description": "The ID of the item that's generated and stored in a client's system. If not provided an id will be automatically generated."
    },
    "appId": {
      "type": "string",
      "readOnly": true
    },
    "state": {
      "$ref": "#/$defs/GroupState",
      "type": "string",
      "readOnly": true,
      "description": "State of the quote group. 'CLOSED' state prevents the group from being used, no new quote requests can be created with that group's id at this point."
    },
    "site": {
      "$ref": "#/$defs/Site"
    },
    "opportunityId": {
      "type": "string",
      "readOnly": true,
      "description": "An internal opportunity id, will be set by Telenor"
    },
    "expectedDeliveryDate": {
      "$ref": "#/$defs/LocalDate",
      "type": "string",
      "description": "Expected installation date for the service"
    },
    "onBehalfOfOrgNr": {
      "type": "string",
      "readOnly": true,
      "description": "Contains organizational number if the request was behalf of another party, e.g. via Mitt Foretag"
    },
    "creationDate": {
      "$ref": "#/$defs/LocalDate",
      "type": "string",
      "readOnly": true
    }
  },
  "$defs": {
    "GroupState": {
      "type": "string",
      "enum": [
        "CREATED",
        "ONGOING",
        "CLOSED"
      ]
    },
    "LocalDate": {
      "type": "string",
      "format": "date"
    },
    "Rt90Coordinate": {
      "type": "object",
      "required": [
        "rt90x",
        "rt90y"
      ],
      "properties": {
        "rt90x": {
          "type": "integer",
          "format": "int32",
          "minimum": 0
        },
        "rt90y": {
          "type": "integer",
          "format": "int32",
          "minimum": 0
        }
      }
    },
    "Site": {
      "type": "object",
      "description": "Represents a site either by id, address or coordinates. At least site id, or address must be present.",
      "properties": {
        "address": {
          "$ref": "#/$defs/SiteAddress",
          "type": "object",
          "description": "The address where the product will be installed"
        },
        "rt90Coordinate": {
          "$ref": "#/$defs/Rt90Coordinate",
          "type": "object",
          "description": "The RT90 coordinate where the product will be installed"
        },
        "siteId": {
          "type": "string",
          "description": "The site Id. If present, the address will be ignored"
        }
      }
    },
    "SiteAddress": {
      "type": "object",
      "required": [
        "street",
        "postalCode",
        "city",
        "country"
      ],
      "properties": {
        "street": {
          "type": "string",
          "pattern": "\\S"
        },
        "streetNumber": {
          "type": "string"
        },
        "postalCode": {
          "type": "string",
          "pattern": "\\S"
        },
        "city": {
          "type": "string",
          "pattern": "\\S"
        },
        "country": {
          "type": "string",
          "pattern": "\\S"
        },
        "apartmentNumber": {
          "type": "string"
        },
        "siteName": {
          "type": "string"
        }
      }
    }
  }
}