{
  "$defs": {
    "FxRate": {
      "description": "One date-indexed rate observation.",
      "properties": {
        "currency": {
          "$ref": "#/$defs/IsoCurrency"
        },
        "date": {
          "$ref": "#/$defs/IsoDate"
        },
        "rate": {
          "format": "double",
          "type": "number"
        },
        "rate_type": {
          "$ref": "#/$defs/RateType"
        }
      },
      "required": [
        "date",
        "currency",
        "rate",
        "rate_type"
      ],
      "type": "object"
    },
    "FxSource": {
      "description": "Source authority for FX rates.",
      "oneOf": [
        {
          "const": "ecb",
          "description": "European Central Bank Euro Foreign Exchange Reference Rates\n(daily ~14:15 CET).",
          "type": "string"
        },
        {
          "const": "fed_h10",
          "description": "US Federal Reserve H.10 release.",
          "type": "string"
        },
        {
          "const": "boe",
          "description": "Bank of England daily rates.",
          "type": "string"
        },
        {
          "const": "snb",
          "description": "Swiss National Bank.",
          "type": "string"
        },
        {
          "const": "customs_de",
          "description": "German customs (Bundesfinanzministerium Monatsumrechnungskurse).",
          "type": "string"
        },
        {
          "const": "customs_us",
          "description": "US customs (CBP daily rates).",
          "type": "string"
        },
        {
          "const": "custom",
          "description": "Adopter-provided custom source (with attribution in `note`).",
          "type": "string"
        }
      ]
    },
    "IsoCurrency": {
      "description": "ISO 4217 currency code.",
      "pattern": "^[A-Z]{3}$",
      "type": "string"
    },
    "IsoDate": {
      "description": "ISO 8601 date (YYYY-MM-DD).",
      "format": "date",
      "type": "string"
    },
    "PathRef": {
      "description": "Path-based cross-reference relative to .corpospec/ root.\nPattern: `^[a-z0-9_-]+(/[a-z0-9_.-]+)+$`",
      "pattern": "^[a-z0-9_-]+(/[a-z0-9_.-]+)+$",
      "type": "string"
    },
    "QuoteBasis": {
      "description": "Direct vs indirect quote basis.",
      "oneOf": [
        {
          "const": "direct",
          "description": "1 base = X foreign (ECB convention: 1 EUR = X USD).",
          "type": "string"
        },
        {
          "const": "indirect",
          "description": "1 foreign = X base (Fed convention for some pairs).",
          "type": "string"
        }
      ]
    },
    "RateType": {
      "description": "Rate-type classification within a feed.",
      "oneOf": [
        {
          "enum": [
            "mid",
            "bid",
            "ask"
          ],
          "type": "string"
        },
        {
          "const": "reference",
          "description": "Authority \"reference\" rate (ECB / Fed reference fixing).",
          "type": "string"
        }
      ]
    }
  },
  "$id": "https://corpospec.com/schemas/v0.16.0/fx-rate-table.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "FX rate table — time series of rates from a single source for a\nsingle base currency. Replaces scalar `FxReference.usd_eur_rate`.",
  "properties": {
    "base_currency": {
      "$ref": "#/$defs/IsoCurrency"
    },
    "id": {
      "$ref": "#/$defs/PathRef"
    },
    "next_refresh_due": {
      "anyOf": [
        {
          "$ref": "#/$defs/IsoDate"
        },
        {
          "type": "null"
        }
      ],
      "description": "Next scheduled refresh date for automated CI refresh."
    },
    "note": {
      "type": [
        "string",
        "null"
      ]
    },
    "quote_basis": {
      "$ref": "#/$defs/QuoteBasis"
    },
    "rates": {
      "items": {
        "$ref": "#/$defs/FxRate"
      },
      "type": "array"
    },
    "source": {
      "$ref": "#/$defs/FxSource"
    }
  },
  "required": [
    "id",
    "base_currency",
    "source",
    "quote_basis",
    "rates"
  ],
  "title": "FxRateTable",
  "type": "object",
  "x-corpospec-pillar": "financials"
}