{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/akeda-ru/json-schema/akeda-ru-core-currency-rate-schema.json",
  "title": "CoreCurrencyRate",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/akeda-ru-core-currency-rates-api-openapi.yml#/components/schemas/CoreCurrencyRate",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "currency_code",
    "base_code",
    "rate",
    "nominal",
    "valid_from",
    "source",
    "reason",
    "created_at"
  ],
  "properties": {
    "id": {
      "$ref": "#/$defs/UUID"
    },
    "currency_code": {
      "type": "string",
      "pattern": "^[A-Z0-9]{3,6}$"
    },
    "base_code": {
      "type": "string",
      "pattern": "^[A-Z0-9]{3,6}$"
    },
    "rate": {
      "type": "string",
      "pattern": "^\\\\+?(?:[0-9]+(?:[.,][0-9]+)?|[.,][0-9]+)$"
    },
    "nominal": {
      "type": "integer",
      "minimum": 1
    },
    "valid_from": {
      "type": "string",
      "format": "date-time"
    },
    "valid_to": {
      "type": "string",
      "format": "date-time"
    },
    "source": {
      "$ref": "#/$defs/CoreCurrencyRateSourceKey"
    },
    "reason": {
      "type": "string"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "CoreCurrencyRateSourceKey": {
      "type": "string",
      "enum": [
        "manual",
        "cbr",
        "ecb",
        "coingecko",
        "erapi",
        "moex",
        "fixed"
      ]
    },
    "UUID": {
      "type": "string",
      "format": "uuid"
    }
  }
}