{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/telenor-sverige/json-schema/telenor-sverige-site-quote-request-schema.json",
  "title": "SiteQuoteRequest",
  "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/SiteQuoteRequest",
  "type": "object",
  "required": [
    "bindingTime",
    "site",
    "product"
  ],
  "properties": {
    "contactMedium": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ContactMedium"
      }
    },
    "notes": {
      "$ref": "#/$defs/Notes",
      "type": "object",
      "description": "Notes regarding the site"
    },
    "externalId": {
      "type": "string",
      "description": "An external id created and owned by the client"
    },
    "quoteId": {
      "type": "string",
      "readOnly": true,
      "description": "The id for the quotation"
    },
    "relatedQuoteUrl": {
      "type": "string",
      "description": "A url to another existing quote. This field is used by clients to indicate that this quote is related (or connected) to another quote item"
    },
    "appId": {
      "type": "string",
      "readOnly": true
    },
    "creationDate": {
      "$ref": "#/$defs/LocalDate",
      "type": "string",
      "readOnly": true
    },
    "opportunityId": {
      "type": "string",
      "readOnly": true,
      "description": "An internal opportunity id, will be set by Telenor"
    },
    "quoteType": {
      "$ref": "#/$defs/OpportunityAction",
      "type": "string",
      "readOnly": true
    },
    "bindingTime": {
      "type": "integer",
      "format": "int32",
      "description": "The binding time (in months) for the services in the quotation",
      "maximum": 60,
      "minimum": 0
    },
    "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"
    },
    "replacesInstalledProductId": {
      "type": "string",
      "description": "The ID of the installed product that the product in this request replaces. Required for (and only applicable to) migration requests."
    },
    "quoteGroupId": {
      "type": "string",
      "description": "The id the group that this quote belongs to. If provided, it must be an id of existing group"
    },
    "site": {
      "$ref": "#/$defs/Site"
    },
    "product": {
      "$ref": "#/$defs/Product"
    }
  },
  "$defs": {
    "AdditionalService": {
      "type": "object",
      "properties": {
        "additionalServiceId": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "format": "int32",
          "description": "The Id of the additional service from Product Catalog"
        },
        "parameters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Parameters"
          }
        }
      }
    },
    "ContactMedium": {
      "type": "object",
      "properties": {
        "mediumType": {
          "$ref": "#/$defs/MediumType"
        },
        "preferred": {
          "type": "boolean"
        },
        "contactDetails": {
          "type": "string",
          "description": "Contact details for the customer who made this quote"
        },
        "validFor": {
          "$ref": "#/$defs/LocalDate"
        }
      }
    },
    "LocalDate": {
      "type": "string",
      "format": "date"
    },
    "MediumType": {
      "type": "string",
      "enum": [
        "EMAIL",
        "PHONE"
      ]
    },
    "Notes": {
      "type": "object",
      "properties": {
        "author": {
          "type": "string",
          "maxLength": 100,
          "description": "The name of the person who wrote this note",
          "maximum": 100
        },
        "date": {
          "$ref": "#/$defs/LocalDate",
          "type": "string",
          "description": "The date when this note was created"
        },
        "text": {
          "type": "string",
          "maxLength": 255,
          "description": "Details about this note",
          "maximum": 255
        }
      }
    },
    "OpportunityAction": {
      "type": "string",
      "enum": [
        "QUOTE",
        "ADD_QUOTE",
        "MIGRATION_QUOTE"
      ]
    },
    "Parameters": {
      "type": "object",
      "properties": {
        "parameterId": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "format": "int32",
          "description": "The Id of the additional service parameter from Product Catalog"
        }
      }
    },
    "Product": {
      "type": "object",
      "required": [
        "productOfferingId",
        "qualityOfServiceId",
        "accessRedundancyId",
        "accessTypeId",
        "accessSpeedId",
        "serviceLevelAgreementId",
        "serviceLevelAgreementLevelId"
      ],
      "properties": {
        "productOfferingId": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "format": "int32",
          "description": "The Product Offering ID from Product Catalog"
        },
        "qualityOfServiceId": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the desired Quality of Service from Product Catalog",
          "minimum": 0
        },
        "accessRedundancyId": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the desired Access Redundancy from Product Catalog",
          "minimum": 0
        },
        "accessTypeId": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the desired Access Type from Product Catalog",
          "minimum": 0
        },
        "accessSpeedId": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the desired Access Speed from Product Catalog",
          "minimum": 0
        },
        "serviceLevelAgreementId": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the desired Service Level Agreement from Product Catalog",
          "minimum": 0
        },
        "serviceLevelAgreementLevelId": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the desired SLA Level from Product Catalog",
          "minimum": 0
        },
        "additionalServices": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AdditionalService"
          }
        }
      }
    },
    "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"
        }
      }
    }
  }
}