{
  "$defs": {
    "Category": {
      "description": "Category contains the definition of a general type of tax inside a region.",
      "properties": {
        "code": {
          "$ref": "https://gobl.org/draft-0/cbc/code",
          "description": "Code to be used in documents",
          "title": "Code"
        },
        "desc": {
          "$ref": "https://gobl.org/draft-0/i18n/string",
          "description": "Useful description of the category.",
          "title": "Description"
        },
        "extensions": {
          "description": "Extensions defines a list of extension keys that may be used or required\nas an alternative or alongside choosing a rate for the tax category.\nEvery key must be defined in the Regime's extensions table.",
          "items": {
            "$ref": "https://gobl.org/draft-0/cbc/key"
          },
          "title": "Extensions",
          "type": "array"
        },
        "map": {
          "$ref": "https://gobl.org/draft-0/cbc/code-map",
          "description": "Map defines a set of regime specific code mappings.",
          "title": "Map"
        },
        "meta": {
          "$ref": "https://gobl.org/draft-0/cbc/meta",
          "description": "Meta contains additional information about the category that is relevant\nfor local frequently used formats.",
          "title": "Meta"
        },
        "name": {
          "$ref": "https://gobl.org/draft-0/i18n/string",
          "description": "Short name of the category to be used instead of code in output",
          "title": "Name"
        },
        "rate_required": {
          "description": "RateRequired when true implies that when a tax combo is defined using\nthis category that one of the rate's keys must be defined. This is\nnormally needed for regimes that categorize taxes in local document\nformats as opposed to grouping by percentage values.",
          "title": "Rate Required",
          "type": "boolean"
        },
        "rates": {
          "description": "Specific tax definitions inside this category.",
          "items": {
            "$ref": "#/$defs/Rate"
          },
          "title": "Rates",
          "type": "array"
        },
        "retained": {
          "description": "Retained when true implies that the tax amount will be retained\nby the buyer on behalf of the supplier, and thus subtracted from\nthe invoice taxable base total. Typically used for taxes related to\nincome.",
          "title": "Retained",
          "type": "boolean"
        },
        "sources": {
          "description": "List of sources for the information contained in this category.",
          "items": {
            "$ref": "#/$defs/Source"
          },
          "title": "Sources",
          "type": "array"
        },
        "title": {
          "$ref": "https://gobl.org/draft-0/i18n/string",
          "description": "Human name for the code to use for titles",
          "title": "Title"
        }
      },
      "required": [
        "code",
        "name"
      ],
      "type": "object"
    },
    "CorrectionDefinition": {
      "description": "CorrectionDefinition contains details about what can be defined in .",
      "properties": {
        "extensions": {
          "description": "Extension keys that can be included",
          "items": {
            "$ref": "https://gobl.org/draft-0/cbc/key"
          },
          "title": "Extensions",
          "type": "array"
        },
        "reason_required": {
          "description": "ReasonRequired when true implies that a reason must be provided",
          "title": "Reason Required",
          "type": "boolean"
        },
        "schema": {
          "description": "Partial or complete schema URL for the document type supported by correction.",
          "title": "Schema",
          "type": "string"
        },
        "stamps": {
          "description": "Stamps that must be copied from the preceding document.",
          "items": {
            "$ref": "https://gobl.org/draft-0/cbc/key"
          },
          "title": "Stamps",
          "type": "array"
        },
        "types": {
          "description": "The types of sub-documents supported by the regime",
          "items": {
            "$ref": "https://gobl.org/draft-0/cbc/key"
          },
          "title": "Types",
          "type": "array"
        }
      },
      "required": [
        "schema"
      ],
      "type": "object"
    },
    "Rate": {
      "description": "Rate defines a single rate inside a category",
      "properties": {
        "desc": {
          "$ref": "https://gobl.org/draft-0/i18n/string",
          "description": "Useful description of the rate.",
          "title": "Description"
        },
        "exempt": {
          "description": "Exempt when true implies that the rate when used in a tax Combo should\nnot define a percent value.",
          "title": "Exempt",
          "type": "boolean"
        },
        "extensions": {
          "description": "Extensions defines a list of keys for codes that can or must be associated with the\ntax rate for it to be validated. Every key must be defined in the Regime's\nextensions.",
          "items": {
            "$ref": "https://gobl.org/draft-0/cbc/key"
          },
          "title": "Extensions",
          "type": "array"
        },
        "key": {
          "$ref": "https://gobl.org/draft-0/cbc/key",
          "description": "Key identifies this rate within the system",
          "title": "Key"
        },
        "map": {
          "$ref": "https://gobl.org/draft-0/cbc/code-map",
          "description": "Map is used to associate specific codes with the chosen rate.",
          "title": "Map"
        },
        "meta": {
          "$ref": "https://gobl.org/draft-0/cbc/meta",
          "description": "Meta contains additional information about the rate that is relevant\nfor local frequently used implementations.",
          "title": "Meta"
        },
        "name": {
          "$ref": "https://gobl.org/draft-0/i18n/string",
          "description": "Human name of the rate",
          "title": "Name"
        },
        "values": {
          "description": "Values contains a list of Value objects that contain the\ncurrent and historical percentage values for the rate and\nadditional filters.\nOrder is important, newer values should come before\nolder values.",
          "items": {
            "$ref": "#/$defs/RateValue"
          },
          "title": "Values",
          "type": "array"
        }
      },
      "required": [
        "key",
        "name"
      ],
      "type": "object"
    },
    "RateValue": {
      "description": "RateValue contains a percentage rate or fixed amount for a given date range.",
      "properties": {
        "disabled": {
          "description": "When true, this value should no longer be used.",
          "title": "Disabled",
          "type": "boolean"
        },
        "ext": {
          "$ref": "https://gobl.org/draft-0/tax/extensions",
          "description": "Ext map of keys that can be used to filter to determine if the rate applies.",
          "title": "Extensions"
        },
        "percent": {
          "$ref": "https://gobl.org/draft-0/num/percentage",
          "description": "Percent rate that should be applied",
          "title": "Percent"
        },
        "since": {
          "$ref": "https://gobl.org/draft-0/cal/date",
          "description": "Date from which this value should be applied.",
          "title": "Since"
        },
        "surcharge": {
          "$ref": "https://gobl.org/draft-0/num/percentage",
          "description": "An additional surcharge to apply.",
          "title": "Surcharge"
        },
        "tags": {
          "description": "Only apply this rate if one of the tags is present in the invoice.",
          "items": {
            "$ref": "https://gobl.org/draft-0/cbc/key"
          },
          "title": "Tags",
          "type": "array"
        }
      },
      "required": [
        "percent"
      ],
      "type": "object"
    },
    "Regime": {
      "description": "Regime defines the holding structure for the definitions of taxes inside a country or territory.",
      "properties": {
        "categories": {
          "description": "List of tax categories.",
          "items": {
            "$ref": "#/$defs/Category"
          },
          "title": "Categories",
          "type": "array"
        },
        "charge_types": {
          "description": "Charge types specific for the regime and may be validated or used in the UI as suggestions",
          "items": {
            "$ref": "https://gobl.org/draft-0/cbc/key-definition"
          },
          "title": "Charge Types",
          "type": "array"
        },
        "corrections": {
          "description": "Configuration details for corrections to be used with correction options.",
          "items": {
            "$ref": "#/$defs/CorrectionDefinition"
          },
          "title": "Corrections",
          "type": "array"
        },
        "country": {
          "$ref": "https://gobl.org/draft-0/l10n/country-code",
          "description": "Country code for the region",
          "title": "Code"
        },
        "currency": {
          "$ref": "https://gobl.org/draft-0/currency/code",
          "description": "Currency used by the country.",
          "title": "Currency"
        },
        "description": {
          "$ref": "https://gobl.org/draft-0/i18n/string",
          "description": "Introductory details about the regime.",
          "title": "Description"
        },
        "extensions": {
          "description": "Extensions defines the keys that can be used for extended or extra data inside the regime that\nis specific to the regime and cannot be easily determined from other GOBL structures.\nTypically these are used to define local codes for suppliers, customers, products, or tax rates.",
          "items": {
            "$ref": "https://gobl.org/draft-0/cbc/key-definition"
          },
          "title": "Extensions",
          "type": "array"
        },
        "identity_types": {
          "description": "Identity types specific for the regime and may be validated\nagainst.",
          "items": {
            "$ref": "https://gobl.org/draft-0/cbc/key-definition"
          },
          "title": "Identity Types",
          "type": "array"
        },
        "inbox_keys": {
          "description": "InboxKeys specific to the regime that can be used to identify where a document\nshould be forwarded to.",
          "items": {
            "$ref": "https://gobl.org/draft-0/cbc/key-definition"
          },
          "title": "Inbox Keys",
          "type": "array"
        },
        "name": {
          "$ref": "https://gobl.org/draft-0/i18n/string",
          "description": "Name of the country",
          "title": "Name"
        },
        "payment_means": {
          "description": "PaymentMeansKeys specific for the regime that extend the original\nbase payment means keys.",
          "items": {
            "$ref": "https://gobl.org/draft-0/cbc/key-definition"
          },
          "title": "Payment Means",
          "type": "array"
        },
        "scenarios": {
          "items": {
            "$ref": "#/$defs/ScenarioSet"
          },
          "title": "Scenarios",
          "type": "array"
        },
        "tags": {
          "description": "Tags that can be applied at the document level to identify additional\nconsiderations.",
          "items": {
            "$ref": "https://gobl.org/draft-0/cbc/key-definition"
          },
          "title": "Tags",
          "type": "array"
        },
        "time_zone": {
          "description": "Location name for the country's central time zone. Accepted\nvalues from IANA Time Zone Database (https://iana.org/time-zones).",
          "title": "Time Zone",
          "type": "string"
        },
        "zone": {
          "$ref": "https://gobl.org/draft-0/l10n/code",
          "description": "Specific Locality, region, city, province, county, or similar code inside\nthe country, if needed.",
          "title": "Zone"
        }
      },
      "required": [
        "name",
        "time_zone",
        "country",
        "currency",
        "categories"
      ],
      "type": "object"
    },
    "Scenario": {
      "description": "Scenario is used to describe a tax scenario of a document based on the combination of document type and tag used.",
      "properties": {
        "codes": {
          "$ref": "https://gobl.org/draft-0/cbc/code-map",
          "description": "Codes is used to define additional codes for regime specific\nsituations.",
          "title": "Codes"
        },
        "meta": {
          "$ref": "https://gobl.org/draft-0/cbc/meta",
          "description": "Any additional local meta data that may be useful in integrations.",
          "title": "Meta"
        },
        "name": {
          "$ref": "https://gobl.org/draft-0/i18n/string",
          "description": "Name of the scenario for further information.",
          "title": "Name"
        },
        "note": {
          "$ref": "https://gobl.org/draft-0/cbc/note",
          "description": "A note to be added to the document if the scenario is applied.",
          "title": "Note"
        },
        "tags": {
          "description": "Tag that was applied to the document",
          "items": {
            "$ref": "https://gobl.org/draft-0/cbc/key"
          },
          "title": "Tag",
          "type": "array"
        },
        "type": {
          "description": "Type of document, if present.",
          "items": {
            "$ref": "https://gobl.org/draft-0/cbc/key"
          },
          "title": "Type",
          "type": "array"
        }
      },
      "type": "object"
    },
    "ScenarioSet": {
      "description": "ScenarioSet is a collection of tax scenarios for a given schema that can be used to determine special codes or notes that need to be included in the final document.",
      "properties": {
        "list": {
          "description": "List of scenarios for the schema",
          "items": {
            "$ref": "#/$defs/Scenario"
          },
          "title": "List",
          "type": "array"
        },
        "schema": {
          "description": "Partial or complete schema URL for the document type",
          "title": "Schema",
          "type": "string"
        }
      },
      "required": [
        "schema",
        "list"
      ],
      "type": "object"
    },
    "Source": {
      "description": "Source describes where the information for the taxes comes from.",
      "properties": {
        "title": {
          "$ref": "https://gobl.org/draft-0/i18n/string",
          "description": "Title of the linked source to help distinguish between this and other links.",
          "title": "Title"
        },
        "url": {
          "description": "URL for the website.",
          "format": "uri",
          "title": "URL",
          "type": "string"
        }
      },
      "required": [
        "url"
      ],
      "type": "object"
    }
  },
  "$id": "https://gobl.org/draft-0/tax/regime",
  "$ref": "#/$defs/Regime",
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}