# Models

## The errorMessage object

```json
{"openapi":"3.0.0","info":{"title":"Tax Service","version":"0.0.1"},"components":{"schemas":{"errorMessage":{"title":"error","description":"Schema for API specified errors.","type":"object","properties":{"taxConfigurationCode":{"type":"string","description":"link to documentation to investigate further and finding support"},"code":{"description":"classification of the error type, lower case with underscore eg validation_failure","type":"integer"},"status":{"description":"original HTTP error code, should be consistent with the response HTTP code","type":"string"},"message":{"description":"descriptive error message for debugging","type":"string"},"details":{"description":"list of problems causing this error","type":"array","items":{"title":"errorDetail","description":"schema for specific error cause","type":"string"}}},"required":["code","status"]}}}}
```

## The metadata object

```json
{"openapi":"3.0.0","info":{"title":"Tax Service","version":"0.0.1"},"components":{"schemas":{"metadata":{"type":"object","properties":{"createdAt":{"description":"Date and time when the object was created.","type":"string","format":"date-time"},"modifiedAt":{"description":"Date and time when the object was last modified.","type":"string","format":"date-time"},"version":{"minimum":1,"type":"integer","description":"Version of the object."}}}}}}
```

## The taxCreation object

```json
{"openapi":"3.0.0","info":{"title":"Tax Service","version":"0.0.1"},"components":{"schemas":{"taxCreation":{"title":"taxCreation","type":"object","description":"Tax configuration for a specified location. It consists of a country code and a list of tax classes applicable in that country.  ","properties":{"location":{"$ref":"#/components/schemas/location"},"taxClasses":{"type":"array","description":"List of tax classes applicable in the specified country.","items":{"$ref":"#/components/schemas/taxClass"}}},"required":["location","taxClasses"]},"location":{"type":"object","description":"","properties":{"countryCode":{"type":"string","description":"Code of the country for which the tax classes are specified, as defined in the Country Service."}},"required":["countryCode"]},"taxClass":{"title":"taxClass","type":"object","description":"Single tax class. ","properties":{"code":{"type":"string","description":"Unique tax class code."},"name":{"description":"Tax class name.\n\n* If the `Content-Language` header is set to `*`, then the name should be provided as a map of translations, where each key is a language code and the value is the name in its respective language.\n* If the `Content-Language` header is set to a specific language, the name should be provided as a string.\n* If the `Content-Language` header is empty, the endpoint will asume that the name is provided in the default language defined in the Configuration Service.\n\n**Note**: You can provide the names only in languages defined in the Configuration Service. In case the name is provided in a language that is not defined in the Configuration Service, the request will be rejected.","oneOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"string"}]},"description":{"description":"Tax class description.\n\n* If the `Content-Language` header is set to `*`, then the description should be provided as a map of translations, where each key is a language code and the value is the description in its respective language.\n* If the `Content-Language` header is set to a specific language, the description should be provided as a string.\n* If the `Content-Language` header is empty, the endpoint will asume that the description is provided in the default language defined in the Configuration Service.\n\n**Note**: You can provide the descriptions only in languages defined in the Configuration Service. In case the description is provided in a language that is not defined in the Configuration Service, the request will be rejected.","oneOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"string"}]},"order":{"type":"integer","description":"Number indicating the position on the tax class list. Tax classes in a configuration are sorted based on their `order` values in ascending order."},"rate":{"type":"number","description":"Tax rate, expressed as a number.\n\nFor example, if the tax rate is 23%, this field should be set to `23`."},"isDefault":{"type":"boolean","description":"Indicates that the tax class is a default tax class for the tax configuration. Only one tax class can be marked as a default for a particular tax configuration."}},"required":["code","name","rate"]}}}}
```

## The taxRetrieval object

```json
{"openapi":"3.0.0","info":{"title":"Tax Service","version":"0.0.1"},"components":{"schemas":{"taxRetrieval":{"title":"taxRetrieval","type":"object","description":"Tax configuration for a specified location. It consists of a country code and a list of tax classes applicable in that country.  ","properties":{"locationCode":{"type":"string"},"location":{"$ref":"#/components/schemas/location"},"taxClasses":{"type":"array","description":"List of tax classes applicable in the specified country.","items":{"$ref":"#/components/schemas/taxClass"}},"metadata":{"$ref":"#/components/schemas/metadata"}}},"location":{"type":"object","description":"","properties":{"countryCode":{"type":"string","description":"Code of the country for which the tax classes are specified, as defined in the Country Service."}},"required":["countryCode"]},"taxClass":{"title":"taxClass","type":"object","description":"Single tax class. ","properties":{"code":{"type":"string","description":"Unique tax class code."},"name":{"description":"Tax class name.\n\n* If the `Content-Language` header is set to `*`, then the name should be provided as a map of translations, where each key is a language code and the value is the name in its respective language.\n* If the `Content-Language` header is set to a specific language, the name should be provided as a string.\n* If the `Content-Language` header is empty, the endpoint will asume that the name is provided in the default language defined in the Configuration Service.\n\n**Note**: You can provide the names only in languages defined in the Configuration Service. In case the name is provided in a language that is not defined in the Configuration Service, the request will be rejected.","oneOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"string"}]},"description":{"description":"Tax class description.\n\n* If the `Content-Language` header is set to `*`, then the description should be provided as a map of translations, where each key is a language code and the value is the description in its respective language.\n* If the `Content-Language` header is set to a specific language, the description should be provided as a string.\n* If the `Content-Language` header is empty, the endpoint will asume that the description is provided in the default language defined in the Configuration Service.\n\n**Note**: You can provide the descriptions only in languages defined in the Configuration Service. In case the description is provided in a language that is not defined in the Configuration Service, the request will be rejected.","oneOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"string"}]},"order":{"type":"integer","description":"Number indicating the position on the tax class list. Tax classes in a configuration are sorted based on their `order` values in ascending order."},"rate":{"type":"number","description":"Tax rate, expressed as a number.\n\nFor example, if the tax rate is 23%, this field should be set to `23`."},"isDefault":{"type":"boolean","description":"Indicates that the tax class is a default tax class for the tax configuration. Only one tax class can be marked as a default for a particular tax configuration."}},"required":["code","name","rate"]},"metadata":{"type":"object","properties":{"createdAt":{"description":"Date and time when the object was created.","type":"string","format":"date-time"},"modifiedAt":{"description":"Date and time when the object was last modified.","type":"string","format":"date-time"},"version":{"minimum":1,"type":"integer","description":"Version of the object."}}}}}}
```

## The taxClass object

```json
{"openapi":"3.0.0","info":{"title":"Tax Service","version":"0.0.1"},"components":{"schemas":{"taxClass":{"title":"taxClass","type":"object","description":"Single tax class. ","properties":{"code":{"type":"string","description":"Unique tax class code."},"name":{"description":"Tax class name.\n\n* If the `Content-Language` header is set to `*`, then the name should be provided as a map of translations, where each key is a language code and the value is the name in its respective language.\n* If the `Content-Language` header is set to a specific language, the name should be provided as a string.\n* If the `Content-Language` header is empty, the endpoint will asume that the name is provided in the default language defined in the Configuration Service.\n\n**Note**: You can provide the names only in languages defined in the Configuration Service. In case the name is provided in a language that is not defined in the Configuration Service, the request will be rejected.","oneOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"string"}]},"description":{"description":"Tax class description.\n\n* If the `Content-Language` header is set to `*`, then the description should be provided as a map of translations, where each key is a language code and the value is the description in its respective language.\n* If the `Content-Language` header is set to a specific language, the description should be provided as a string.\n* If the `Content-Language` header is empty, the endpoint will asume that the description is provided in the default language defined in the Configuration Service.\n\n**Note**: You can provide the descriptions only in languages defined in the Configuration Service. In case the description is provided in a language that is not defined in the Configuration Service, the request will be rejected.","oneOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"string"}]},"order":{"type":"integer","description":"Number indicating the position on the tax class list. Tax classes in a configuration are sorted based on their `order` values in ascending order."},"rate":{"type":"number","description":"Tax rate, expressed as a number.\n\nFor example, if the tax rate is 23%, this field should be set to `23`."},"isDefault":{"type":"boolean","description":"Indicates that the tax class is a default tax class for the tax configuration. Only one tax class can be marked as a default for a particular tax configuration."}},"required":["code","name","rate"]}}}}
```

## The taxCreationResponse object

```json
{"openapi":"3.0.0","info":{"title":"Tax Service","version":"0.0.1"},"components":{"schemas":{"taxCreationResponse":{"title":"taxCreationResponse","type":"object","description":"","properties":{"locationCode":{"type":"string","description":"Code of country for which the tax configuration has been created."}}}}}}
```

## The taxCalculationRequest object

```json
{"openapi":"3.0.0","info":{"title":"Tax Service","version":"0.0.1"},"components":{"schemas":{"taxCalculationRequest":{"title":"","type":"object","description":"","properties":{"commandUuid":{"type":"string","description":"Calculation command's unique identifier.\n\n**Note**: This field is optional. If not specified, the `commandUuid` will be generated by the server."},"input":{"type":"object","description":"Information based on which the price will be calculated.","required":["targetTaxClass","targetLocation","price"],"properties":{"sourceLocation":{"description":"Country for which the provided price is originally defined.\n\n**Note**: This field is only mandatory if the `includesTax` field is set to `true`.","allOf":[{"$ref":"#/components/schemas/location"}]},"sourceTaxClass":{"type":"string","description":"Tax class originally applied to the provided price.\n\n**Note**: This field is only mandatory if the `includesTax` field is set to `true`."},"targetLocation":{"description":"Country for which the price should be calculated.","allOf":[{"$ref":"#/components/schemas/location"}]},"targetTaxClass":{"type":"string","description":"Tax class that should be applied when calculating the price."},"includesTax":{"type":"boolean","description":"Flag indicating whether the value provided in the `price` field is expressed as net or gross.\n\n| Value | Description |\n| --- | --- |\n| `true` | Prices are expressed as gross values. |\n| `false` | Prices are expressed as net values. |"},"price":{"type":"number","description":"Original price value.\n\nThis field should contain by a number where the cent part is separated by a dot sign - such as `12.99`.\n\n**Note**: The cent part of the price is not limited to two digits. You can specify the price with any precision."}}}},"required":["input"]},"location":{"type":"object","description":"","properties":{"countryCode":{"type":"string","description":"Code of the country for which the tax classes are specified, as defined in the Country Service."}},"required":["countryCode"]}}}}
```

## The taxCalculationResponse object

```json
{"openapi":"3.0.0","info":{"title":"Tax Service","version":"0.0.1"},"components":{"schemas":{"taxCalculationResponse":{"title":"","type":"object","description":"","properties":{"commandUuid":{"type":"string","description":"Calculation command's unique identifier."},"input":{"type":"object","description":"Information based on which the price was calculated.","properties":{"sourceLocation":{"description":"Country for which the provided price was originally defined.","allOf":[{"$ref":"#/components/schemas/location"}]},"sourceTaxClass":{"type":"string","description":"Tax class originally applied to the provided price."},"targetLocation":{"description":"Country for which the price was calculated.","allOf":[{"$ref":"#/components/schemas/location"}]},"targetTaxClass":{"type":"string","description":"Tax class that was applied when calculating the price."},"includesTax":{"type":"boolean","description":"Flag indicating whether the price provided in the request was expressed as net or gross.\n\n| Value | Description |\n| --- | --- |\n| `true` | Prices will be expressed as gross values. |\n| `false` | Prices will be expressed as net values. |"},"price":{"type":"number","description":"Original price value."}}},"output":{"type":"object","description":"Calculation results.","properties":{"netPrice":{"type":"number","description":"Calculated net price."},"grossPrice":{"type":"number","description":"Calculated gross price."},"sourceTaxRate":{"type":"number","description":"Tax rate originally applied to the provided price."},"targetTaxRate":{"type":"number","description":"Tax rate that was applied when calculating the price."}}}}},"location":{"type":"object","description":"","properties":{"countryCode":{"type":"string","description":"Code of the country for which the tax classes are specified, as defined in the Country Service."}},"required":["countryCode"]}}}}
```

## The location object

```json
{"openapi":"3.0.0","info":{"title":"Tax Service","version":"0.0.1"},"components":{"schemas":{"location":{"type":"object","description":"","properties":{"countryCode":{"type":"string","description":"Code of the country for which the tax classes are specified, as defined in the Country Service."}},"required":["countryCode"]}}}}
```

## The taxUpdate object

```json
{"openapi":"3.0.0","info":{"title":"Tax Service","version":"0.0.1"},"components":{"schemas":{"taxUpdate":{"title":"taxUpdate","allOf":[{"$ref":"#/components/schemas/taxCreation"},{"type":"object","properties":{"metadata":{"$ref":"#/components/schemas/metadata"}},"required":["metadata"]}]},"taxCreation":{"title":"taxCreation","type":"object","description":"Tax configuration for a specified location. It consists of a country code and a list of tax classes applicable in that country.  ","properties":{"location":{"$ref":"#/components/schemas/location"},"taxClasses":{"type":"array","description":"List of tax classes applicable in the specified country.","items":{"$ref":"#/components/schemas/taxClass"}}},"required":["location","taxClasses"]},"location":{"type":"object","description":"","properties":{"countryCode":{"type":"string","description":"Code of the country for which the tax classes are specified, as defined in the Country Service."}},"required":["countryCode"]},"taxClass":{"title":"taxClass","type":"object","description":"Single tax class. ","properties":{"code":{"type":"string","description":"Unique tax class code."},"name":{"description":"Tax class name.\n\n* If the `Content-Language` header is set to `*`, then the name should be provided as a map of translations, where each key is a language code and the value is the name in its respective language.\n* If the `Content-Language` header is set to a specific language, the name should be provided as a string.\n* If the `Content-Language` header is empty, the endpoint will asume that the name is provided in the default language defined in the Configuration Service.\n\n**Note**: You can provide the names only in languages defined in the Configuration Service. In case the name is provided in a language that is not defined in the Configuration Service, the request will be rejected.","oneOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"string"}]},"description":{"description":"Tax class description.\n\n* If the `Content-Language` header is set to `*`, then the description should be provided as a map of translations, where each key is a language code and the value is the description in its respective language.\n* If the `Content-Language` header is set to a specific language, the description should be provided as a string.\n* If the `Content-Language` header is empty, the endpoint will asume that the description is provided in the default language defined in the Configuration Service.\n\n**Note**: You can provide the descriptions only in languages defined in the Configuration Service. In case the description is provided in a language that is not defined in the Configuration Service, the request will be rejected.","oneOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"string"}]},"order":{"type":"integer","description":"Number indicating the position on the tax class list. Tax classes in a configuration are sorted based on their `order` values in ascending order."},"rate":{"type":"number","description":"Tax rate, expressed as a number.\n\nFor example, if the tax rate is 23%, this field should be set to `23`."},"isDefault":{"type":"boolean","description":"Indicates that the tax class is a default tax class for the tax configuration. Only one tax class can be marked as a default for a particular tax configuration."}},"required":["code","name","rate"]},"metadata":{"type":"object","properties":{"createdAt":{"description":"Date and time when the object was created.","type":"string","format":"date-time"},"modifiedAt":{"description":"Date and time when the object was last modified.","type":"string","format":"date-time"},"version":{"minimum":1,"type":"integer","description":"Version of the object."}}}}}}
```
