{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/entur/json-schema/entur-entitlement-given-schema.json",
  "title": "EntitlementGiven",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/entur-entitlement-given-api-openapi.yml#/components/schemas/EntitlementGiven",
  "required": [
    "changed",
    "created",
    "description",
    "entitlementType",
    "fareFrameRef",
    "id",
    "modification",
    "name",
    "nameOfClass",
    "prices",
    "status",
    "version"
  ],
  "type": "object",
  "properties": {
    "changed": {
      "type": "string",
      "description": "Changed datetime",
      "readOnly": true
    },
    "created": {
      "type": "string",
      "description": "Created datetime",
      "readOnly": true
    },
    "description": {
      "type": "array",
      "description": "Description represented in different languages. Language codes are ISO-639",
      "items": {
        "$ref": "#/$defs/TextInLanguage"
      }
    },
    "entitlementConstraint": {
      "$ref": "#/$defs/EntitlementConstraint"
    },
    "entitlementType": {
      "type": "string",
      "description": "Entitlement type",
      "enum": [
        "USE",
        "PURCHASE",
        "PURCHASE_AT_DISCOUNT",
        "NONE"
      ]
    },
    "fareFrameRef": {
      "$ref": "#/$defs/VersionOfObjectRef"
    },
    "id": {
      "minLength": 1,
      "pattern": "^([A-Z]{3}):([A-Za-z]*):([0-9A-Za-z_\\-]*)$",
      "type": "string",
      "description": "Id"
    },
    "minimumQualificationPeriod": {
      "type": "string",
      "description": "Minimum qualification period"
    },
    "modification": {
      "type": "string",
      "description": "Modification status",
      "readOnly": true,
      "enum": [
        "NEW",
        "REVISE",
        "DELETE"
      ]
    },
    "name": {
      "type": "array",
      "description": "The name of the entitlement given represented in different languages. Language codes are ISO-639",
      "items": {
        "$ref": "#/$defs/TextInLanguage"
      }
    },
    "nameOfClass": {
      "type": "string",
      "description": "Name of class",
      "readOnly": true
    },
    "prices": {
      "type": "array",
      "description": "Prices for the entitlement given.",
      "items": {
        "$ref": "#/$defs/FarePrice"
      }
    },
    "serviceAccessRightRef": {
      "$ref": "#/$defs/VersionOfObjectRef"
    },
    "status": {
      "type": "string",
      "description": "Status",
      "readOnly": true,
      "enum": [
        "DRAFT",
        "PROPOSED",
        "VERSIONED",
        "DEPRECATED"
      ]
    },
    "version": {
      "minLength": 1,
      "pattern": "^([A-Z]{3}):([A-Za-z]*):([0-9A-Za-z_\\-]*)$",
      "type": "string",
      "description": "Version"
    }
  },
  "$defs": {
    "EntitlementConstraint": {
      "required": [
        "nameOfClass"
      ],
      "type": "object",
      "properties": {
        "classOfUseConstraint": {
          "type": "string",
          "description": "Class of use constraint",
          "enum": [
            "ANY",
            "SAME",
            "SAME_OR_EQUIVALENT",
            "DIFFERENT"
          ]
        },
        "destinationConstraint": {
          "type": "string",
          "description": "Destination constraint",
          "enum": [
            "ANY",
            "SAME",
            "SAME_AS_ORIGIN",
            "SAME_AS_DESTINATION",
            "SAME_AS_ORIGIN_OR_DESTINATION",
            "ANY_STOP_ON_ROUTE",
            "ANY_STOP_IN_ZONE",
            "DIFFERENT"
          ]
        },
        "directionConstraint": {
          "type": "string",
          "description": "Direction constraint",
          "enum": [
            "ANY",
            "SAME",
            "OPPOSITE_DIRECTION",
            "DIFFERENT"
          ]
        },
        "fareScheduledStopPoints": {
          "type": "array",
          "description": "Fare scheduled stop points which entitlement applies",
          "items": {
            "$ref": "#/$defs/FareScheduledStopPoint"
          }
        },
        "journeyConstraint": {
          "type": "string",
          "description": "Journey constraint",
          "enum": [
            "ANY",
            "SAME",
            "SIMILAR",
            "DIFFERENT"
          ]
        },
        "nameOfClass": {
          "type": "string",
          "description": "Name of class",
          "readOnly": true
        },
        "operatorConstraint": {
          "type": "string",
          "description": "Operator constraint",
          "enum": [
            "ANY",
            "SAME",
            "PARTICIPATING",
            "DIFFERENT"
          ]
        },
        "originConstraint": {
          "type": "string",
          "description": "Origin constraint",
          "enum": [
            "ANY",
            "SAME",
            "SAME_AS_ORIGIN",
            "SAME_AS_DESTINATION",
            "SAME_AS_ORIGIN_OR_DESTINATION",
            "ANY_STOP_ON_ROUTE",
            "ANY_STOP_IN_ZONE",
            "DIFFERENT"
          ]
        },
        "periodConstraint": {
          "type": "string",
          "description": "Period constraint",
          "enum": [
            "ANY",
            "SAME_PERIOD",
            "WITHIN_SAME_PERIOD",
            "SAME_DAY",
            "SAME_DAY_OF_RETURN",
            "SAME_FARE_DAY",
            "NEXT_DAY",
            "EQUIVALENT_DURATION",
            "DIFFERENT"
          ]
        },
        "routeConstraint": {
          "type": "string",
          "description": "Route constraint",
          "enum": [
            "ANY",
            "SAME",
            "OPPOSITE_DIRECTION",
            "DIFFERENT"
          ]
        },
        "specificProfiles": {
          "type": "array",
          "description": "Specific user profiles which entitlement applies",
          "items": {
            "type": "string"
          }
        },
        "tariffZoneConstraint": {
          "type": "string",
          "description": "Tariff zone constraint",
          "enum": [
            "ANY",
            "SAME",
            "SAME_AS_ORIGIN",
            "SAME_AS_DESTINATION",
            "SAME_AS_ORIGIN_OR_DESTINATION",
            "WITHIN",
            "CONTAINING",
            "EQUIVALENT",
            "DIFFERENT"
          ]
        },
        "typeOfProductCategoryConstraint": {
          "type": "string",
          "description": "Type of product category constraint",
          "enum": [
            "ANY",
            "SAME",
            "SAME_OR_EQUIVALENT",
            "DIFFERENT"
          ]
        },
        "typeOfTravelDocumentConstraint": {
          "type": "string",
          "description": "Type of travel document constraint",
          "enum": [
            "ANY",
            "SAME",
            "SAME_MEDIA",
            "SAME_SMART_CARD",
            "SAME_MOBILE_APP",
            "DIFFERENT"
          ]
        },
        "userConstraint": {
          "type": "string",
          "description": "User constraint",
          "enum": [
            "ANYONE",
            "SAME_PERSON",
            "DIFFERENT_PERSON",
            "SPECIFIC"
          ]
        }
      },
      "description": "Entitlement Constraint. Only allowed values for now is periodConstraint.SAME_PERIOD and tariffZoneConstraint.SAME_AS_ORIGIN_OR_DESTINATION. Trying to write other values will give  HTTP.BAD_REQUEST.",
      "readOnly": true
    },
    "FarePrice": {
      "required": [
        "changed",
        "created",
        "fareFrameRef",
        "id",
        "modification",
        "nameOfClass",
        "status"
      ],
      "type": "object",
      "properties": {
        "amount": {
          "type": "string",
          "description": "Amount"
        },
        "canBeCumulative": {
          "type": "boolean",
          "description": "canBeCumulative."
        },
        "changed": {
          "type": "string",
          "description": "Changed datetime.",
          "readOnly": true
        },
        "compatibleWithVersionRef": {
          "type": "string",
          "description": "Compatible with version."
        },
        "created": {
          "type": "string",
          "description": "Created datetime.",
          "readOnly": true
        },
        "currency": {
          "type": "string",
          "description": "Currency."
        },
        "derivedFromVersionRef": {
          "type": "string",
          "description": "Derived from version."
        },
        "discountPercentageUsed": {
          "maximum": 100,
          "minimum": -100,
          "type": "integer",
          "description": "discountPercentageUsed.",
          "format": "int32"
        },
        "fareFrameRef": {
          "$ref": "#/$defs/VersionOfObjectRef"
        },
        "id": {
          "minLength": 1,
          "type": "string",
          "description": "Id."
        },
        "isAllowed": {
          "type": "boolean",
          "description": "isAllowed."
        },
        "limitingRule": {
          "$ref": "#/$defs/LimitingRule"
        },
        "modification": {
          "type": "string",
          "description": "Modification status.",
          "readOnly": true,
          "enum": [
            "NEW",
            "REVISE",
            "DELETE"
          ]
        },
        "name": {
          "type": "array",
          "description": "Name.",
          "items": {
            "$ref": "#/$defs/TextInLanguage"
          }
        },
        "nameOfClass": {
          "type": "string",
          "description": "Name of class.",
          "readOnly": true
        },
        "ranking": {
          "type": "integer",
          "description": "Ranking.",
          "format": "int32"
        },
        "rounding": {
          "$ref": "#/$defs/Rounding"
        },
        "roundingRef": {
          "$ref": "#/$defs/VersionOfObjectRef"
        },
        "status": {
          "type": "string",
          "description": "Status.",
          "readOnly": true,
          "enum": [
            "DRAFT",
            "PROPOSED",
            "VERSIONED",
            "DEPRECATED"
          ]
        },
        "vatRegisterGroup": {
          "type": "string",
          "description": "vatRegisterGroup.",
          "enum": [
            "EXCEPTION_FROM_VAT",
            "GENERAL_VAT",
            "FOOD_VAT",
            "TRANSPORT_AND_TICKETS_VAT"
          ]
        },
        "version": {
          "type": "string",
          "description": "Version.",
          "readOnly": true
        }
      },
      "description": "A description of the price and factor for a set fare"
    },
    "FareScheduledStopPoint": {
      "type": "object",
      "properties": {
        "stopPlaceNetexId": {
          "pattern": "^([A-Z]{3}):([A-Za-z]*):([0-9A-Za-z_\\-]*)$",
          "type": "string",
          "description": "Stop place Netex Id"
        },
        "stopPointNetexId": {
          "pattern": "^([A-Z]{3}):([A-Za-z]*):([0-9A-Za-z_\\-]*)$",
          "type": "string",
          "description": "Stop point Netex Id"
        }
      },
      "description": "FareScheduledStopPoint, stopPlace and stopPoint Netex Ids should point to same location"
    },
    "LimitingRule": {
      "required": [
        "changed",
        "created",
        "fareFrameRef",
        "id",
        "modification",
        "nameOfClass",
        "status"
      ],
      "type": "object",
      "properties": {
        "canBeCumulative": {
          "type": "boolean",
          "description": "CanBeCumulative."
        },
        "changed": {
          "type": "string",
          "description": "Changed datetime.",
          "readOnly": true
        },
        "compatibleWithVersionRef": {
          "type": "string",
          "description": "Compatible with version."
        },
        "created": {
          "type": "string",
          "description": "Created datetime.",
          "readOnly": true
        },
        "derivedFromVersionRef": {
          "type": "string",
          "description": "Derived from version."
        },
        "description": {
          "type": "array",
          "description": "Description.",
          "items": {
            "$ref": "#/$defs/TextInLanguage"
          }
        },
        "discountAsPercentage": {
          "type": "number",
          "description": "DiscountAsPercentage.",
          "format": "float"
        },
        "discountAsValue": {
          "type": "number",
          "description": "DiscountAsValue.",
          "format": "float"
        },
        "fareFrameRef": {
          "$ref": "#/$defs/VersionOfObjectRef"
        },
        "id": {
          "minLength": 1,
          "pattern": "^([A-Z]{3}):([A-Za-z]*):([0-9A-Za-z_\\-]*)$",
          "type": "string",
          "description": "Id."
        },
        "maximumPrice": {
          "type": "string",
          "description": "MaximumPrice."
        },
        "maximumPriceAsPercentage": {
          "type": "number",
          "description": "MaximumPriceAsPercentage.",
          "format": "double"
        },
        "minimumLimitPrice": {
          "type": "string",
          "description": "MinimumLimitPrice."
        },
        "minimumPrice": {
          "type": "string",
          "description": "MinimumPrice."
        },
        "modification": {
          "type": "string",
          "description": "Modification status.",
          "readOnly": true,
          "enum": [
            "NEW",
            "REVISE",
            "DELETE"
          ]
        },
        "name": {
          "type": "array",
          "description": "Name.",
          "items": {
            "$ref": "#/$defs/TextInLanguage"
          }
        },
        "nameOfClass": {
          "type": "string",
          "description": "Name of class.",
          "readOnly": true
        },
        "status": {
          "type": "string",
          "description": "Status.",
          "readOnly": true,
          "enum": [
            "DRAFT",
            "PROPOSED",
            "VERSIONED",
            "DEPRECATED"
          ]
        },
        "version": {
          "minLength": 1,
          "pattern": "^([A-Z]{3}):([A-Za-z]*):([0-9A-Za-z_\\-]*)$",
          "type": "string",
          "description": "Version."
        }
      },
      "description": "A LimitingRule"
    },
    "Rounding": {
      "required": [
        "changed",
        "created",
        "fareFrameRef",
        "id",
        "modification",
        "nameOfClass",
        "roundingMethod",
        "status",
        "version"
      ],
      "type": "object",
      "properties": {
        "changed": {
          "type": "string",
          "description": "Changed datetime.",
          "readOnly": true
        },
        "compatibleWithVersionRef": {
          "type": "string",
          "description": "Compatible with version."
        },
        "created": {
          "type": "string",
          "description": "Created datetime.",
          "readOnly": true
        },
        "derivedFromVersionRef": {
          "type": "string",
          "description": "Derived from version."
        },
        "description": {
          "type": "array",
          "description": "Description.",
          "items": {
            "$ref": "#/$defs/TextInLanguage"
          }
        },
        "fareFrameRef": {
          "$ref": "#/$defs/VersionOfObjectRef"
        },
        "id": {
          "minLength": 1,
          "pattern": "^([A-Z]{3}):([A-Za-z]*):([0-9A-Za-z_\\-]*)$",
          "type": "string",
          "description": "Id."
        },
        "modification": {
          "type": "string",
          "description": "Modification status.",
          "readOnly": true,
          "enum": [
            "NEW",
            "REVISE",
            "DELETE"
          ]
        },
        "name": {
          "type": "array",
          "description": "Name.",
          "items": {
            "$ref": "#/$defs/TextInLanguage"
          }
        },
        "nameOfClass": {
          "type": "string",
          "description": "Name of class.",
          "readOnly": true
        },
        "roundingMethod": {
          "type": "string",
          "description": "Type of rounding.",
          "enum": [
            "NONE",
            "DOWN",
            "UP",
            "SPLIT",
            "STEP_TABLE",
            "FIVE",
            "NINE",
            "TEN",
            "FORTY_NINE"
          ]
        },
        "roundingModulus": {
          "type": "number",
          "description": "Amount by which rounding is to be quantised, i.e. results should be quantised to nearest whole multiple of this value.",
          "format": "double"
        },
        "status": {
          "type": "string",
          "description": "Rounding status.",
          "readOnly": true,
          "enum": [
            "DRAFT",
            "PROPOSED",
            "VERSIONED",
            "DEPRECATED"
          ]
        },
        "version": {
          "minLength": 1,
          "pattern": "^([A-Z]{3}):([A-Za-z]*):([0-9A-Za-z_\\-]*)$",
          "type": "string",
          "description": "Rounding version."
        }
      },
      "description": "A description of how prices are rounded post calculation",
      "deprecated": true
    },
    "TextInLanguage": {
      "required": [
        "lang",
        "value"
      ],
      "type": "object",
      "properties": {
        "lang": {
          "minLength": 1,
          "type": "string",
          "description": "Language code."
        },
        "value": {
          "minLength": 1,
          "type": "string",
          "description": "The text."
        }
      },
      "description": "Text in a specific language."
    },
    "VersionOfObjectRef": {
      "required": [
        "nameOfClass",
        "ref",
        "version"
      ],
      "type": "object",
      "properties": {
        "nameOfClass": {
          "minLength": 1,
          "type": "string",
          "description": "Name of class."
        },
        "ref": {
          "minLength": 1,
          "pattern": "^([A-Z]{3}):([A-Za-z]*):([0-9A-Za-z_\\-]*)$",
          "type": "string",
          "description": "The netex id reference to the object."
        },
        "version": {
          "type": "string",
          "description": "Version."
        }
      },
      "description": "Fare frame ref."
    }
  }
}