# Models

## The errorMessage object

```json
{"openapi":"3.0.0","info":{"title":"Currency Service","version":"0.0.1"},"components":{"schemas":{"errorMessage":{"title":"error","description":"Schema for API-specific errors.","type":"object","properties":{"currencyCode":{"type":"string"},"code":{"description":"Original HTTP error code, should be consistent with the response HTTP code.","type":"integer"},"status":{"description":"classification of the error type, lower case with underscore eg validation_failure","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"}},"errorCode":{"type":"string"}},"required":["status","code"]}}}}
```

## The metadata object

```json
{"openapi":"3.0.0","info":{"title":"Currency Service","version":"0.0.1"},"components":{"schemas":{"metadata":{"type":"object","properties":{"createdAt":{"description":"Time of document creation.","type":"string","format":"date-time"},"modifiedAt":{"description":"Time of document modification.","type":"string","format":"date-time"},"version":{"minimum":1,"type":"integer","description":"Document version."}}}}}}
```

## The updateMetadata object

```json
{"openapi":"3.0.0","info":{"title":"Currency Service","version":"0.0.1"},"components":{"schemas":{"updateMetadata":{"type":"object","properties":{"version":{"minimum":1,"type":"integer","description":"Current version of the updated document."}},"required":["version"]}}}}
```

## The currencyCreation object

```json
{"openapi":"3.0.0","info":{"title":"Currency Service","version":"0.0.1"},"components":{"schemas":{"currencyCreation":{"type":"object","title":"currencyCreation","description":"Represents a single currency creation. The currency consists of a code compliant with the ISO-4217 standard (https://www.iso.org/iso-4217-currency-codes.html) and a currency name. The `name` field is localized.","properties":{"code":{"type":"string","description":"Currency code. The currency symbol must consist of three capital letters and must be a valid ISO-4217 code (https://www.iso.org/iso-4217-currency-codes.html).\n"},"name":{"oneOf":[{"type":"string","description":"Currency name in the specified language."},{"type":"object","description":"Map of translations in the `key:value` pairs format, where `key` is the language code, and `value` is the translation.\nBoth the source and target currency codes must be compliant with the ISO-4217 standard (https://www.iso.org/iso-4217-currency-codes.html) and must be defined in the system.","additionalProperties":{"type":"string"}}],"description":"Currency name. If the `Content-Language` is set to `*`, the field should be provided as a map that contains all translations in the `key:value` pairs format, where `key` is the language code and `value` is the translation. If the `Content-Language` contains a single language, the translation should be passed as a string value. If the `Accept-Language` header is empty, the translation will be returned in the language defined in the `Configuration service` as default.\n\n**Note:** Only the languages defined in the system are allowed to be used here. If a language code not defined in the system is provided, the request will be rejected."}},"required":["code","name"]}}}}
```

## The currencyUpdate object

```json
{"openapi":"3.0.0","info":{"title":"Currency Service","version":"0.0.1"},"components":{"schemas":{"currencyUpdate":{"title":"currencyUpdate","type":"object","description":"Represents a single currency update.","properties":{"name":{"oneOf":[{"type":"string","description":"Currency name in the specified language."},{"type":"object","description":"Map of translations in the `key:value` pairs format, where `key` is the language code and `value` is the translation.\nBoth the source and target currency codes must be compliant with the ISO-4217 standard (see https://www.iso.org/iso-4217-currency-codes.html).","additionalProperties":{"type":"string"}}],"description":"The currency name. If the `Content-Language` is set to `*`, the field should be provided as a map that contains all translations in the format of `key:value` pairs, where `key` is the language code and `value` is the translation. If the `Content-Language` contains a single language, the translation should be passed as a string value. If the `Content-Language` header is empty, the default language defined in the `Configuration service` is taken.\n\nOnly the languages defined in the system are allowed to be used here. If a language code not defined in the system is provided, the request will be rejected."},"metadata":{"$ref":"#/components/schemas/updateMetadata"}},"required":["name","metadata"]},"updateMetadata":{"type":"object","properties":{"version":{"minimum":1,"type":"integer","description":"Current version of the updated document."}},"required":["version"]}}}}
```

## The currencyCreationResponse object

```json
{"openapi":"3.0.0","info":{"title":"Currency Service","version":"0.0.1"},"components":{"schemas":{"currencyCreationResponse":{"title":"currencyCreationResponse","type":"object","description":"Represents the response after a successful currency creation.","properties":{"code":{"type":"string","description":"Code of the newly created currency.\n"}}}}}}
```

## The exchangeRateResponse object

```json
{"openapi":"3.0.0","info":{"title":"Currency Service","version":"0.0.1"},"components":{"schemas":{"exchangeRateResponse":{"title":"exchangeRateResponse","type":"object","description":"Represents the response after a successful exchange rate creation.","properties":{"code":{"type":"string","description":"Code of the newly created exchange rate in the following format: `sourceCurrency_targetCurrency`.\n"}}}}}}
```

## The currencyRetrieval object

```json
{"openapi":"3.0.0","info":{"title":"Currency Service","version":"0.0.1"},"components":{"schemas":{"currencyRetrieval":{"title":"currencyRetrieval","type":"object","description":"Represents a single currency. The currency consists of a code compliant with ISO-4217 (https://www.iso.org/iso-4217-currency-codes.html) and a currency name. The name field is localized.","properties":{"code":{"type":"string","description":"Currency code. The currency symbol consists of three capital letters and is a valid ISO-4217 code (https://www.iso.org/iso-4217-currency-codes.html).\n"},"name":{"oneOf":[{"type":"string","description":"Currency name in the specified language."},{"type":"object","description":"Map of translations in the form of `key:value` pairs, where `key` is the language code and `value` is the translation.\nBoth the source and target currency codes must be compliant with the ISO-4217 standard (see https://www.iso.org/iso-4217-currency-codes.html).","additionalProperties":{"type":"string"}}],"description":"The currency name.\nIf the `Accept-Language` is set to `*`, each internationalized field is returned as a map that contains all translations in the format of `key:value` pairs, where `key` is the language code and `value` is the translation.\nThe `Accept-Language` can contain the priority list of languages which should be returned. Always one language is returned as a single string field. Example: 'fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7'\nIf the `Accept-Language` header is empty, the translation will be returned in the language defined in the `Configuration service` as default."},"metadata":{"$ref":"#/components/schemas/metadata"}}},"metadata":{"type":"object","properties":{"createdAt":{"description":"Time of document creation.","type":"string","format":"date-time"},"modifiedAt":{"description":"Time of document modification.","type":"string","format":"date-time"},"version":{"minimum":1,"type":"integer","description":"Document version."}}}}}}
```

## The exchangeRateUpdateRequest object

```json
{"openapi":"3.0.0","info":{"title":"Currency Service","version":"0.0.1"},"components":{"schemas":{"exchangeRateUpdateRequest":{"title":"exchangeRateUpdateRequest","type":"object","properties":{"rate":{"type":"string","description":"Represents the exchange rate.\n\nThe value of the field is represented by a number where the cent part is separated by a comma. For example, `1.09`. The cent part is not limited just to two digits. A rate with any precision can be returned. For example: `1.09193421`"},"metadata":{"$ref":"#/components/schemas/updateMetadata"}},"required":["rate","metadata"]},"updateMetadata":{"type":"object","properties":{"version":{"minimum":1,"type":"integer","description":"Current version of the updated document."}},"required":["version"]}}}}
```

## The exchangeRateCreationRequest object

```json
{"openapi":"3.0.0","info":{"title":"Currency Service","version":"0.0.1"},"components":{"schemas":{"exchangeRateCreationRequest":{"title":"exchangeRate","type":"object","properties":{"sourceCurrency":{"type":"string","description":"The source currency code. The currency symbol must consist of three capital letters and must be a valid ISO-4217 code (https://www.iso.org/iso-4217-currency-codes.html) defined in the system."},"targetCurrency":{"type":"string","description":"The target currency code. The currency symbol must consist of three capital letters and must be a valid ISO-4217 code (https://www.iso.org/iso-4217-currency-codes.html) defined in the system."},"rate":{"type":"string","description":"Represents the exchange rate.\n\nThe value of the field is represented by a number where the cent part is separated by a comma. For example `1.09`. The cent part is not limited just to two digits. A rate with any precision can be returned. For example: `1.091934212`"}},"required":["sourceCurrency","targetCurrency","rate"]}}}}
```

## The exchangeRateRetrieval object

```json
{"openapi":"3.0.0","info":{"title":"Currency Service","version":"0.0.1"},"components":{"schemas":{"exchangeRateRetrieval":{"title":"exchangeRateRetrieval","type":"object","properties":{"code":{"type":"string","description":"Identifier of the exchange rate. The identifier consists of the source currency and the target currency separated by an underscore."},"sourceCurrency":{"type":"string","description":"Source currency code. The currency symbol must consist of three capital letters and must be a valid ISO-4217 code (https://www.iso.org/iso-4217-currency-codes.html) defined in the system."},"targetCurrency":{"type":"string","description":"Target currency code. The currency symbol must consist of three capital letters and must be a valid ISO-4217 code (https://www.iso.org/iso-4217-currency-codes.html) defined in the system."},"rate":{"type":"string","description":"Represents the exchange rate.\n\nThe value of the field is represented by a number where the cent part is separated by a dot. For example `1.09`. The cent part is not limited just to two digits. A rate with any precision can be returned. For example: `1.091934212`"},"metadata":{"$ref":"#/components/schemas/metadata"}}},"metadata":{"type":"object","properties":{"createdAt":{"description":"Time of document creation.","type":"string","format":"date-time"},"modifiedAt":{"description":"Time of document modification.","type":"string","format":"date-time"},"version":{"minimum":1,"type":"integer","description":"Document version."}}}}}}
```
