{
  "$defs": {
    "CurrencyPair": {
      "description": "Currency pair.",
      "properties": {
        "from": {
          "$ref": "#/$defs/IsoCurrency"
        },
        "to": {
          "$ref": "#/$defs/IsoCurrency"
        }
      },
      "required": [
        "from",
        "to"
      ],
      "type": "object"
    },
    "FxDerivative": {
      "description": "Active derivative hedge instrument.",
      "properties": {
        "counterparty": {
          "$ref": "#/$defs/PathRef"
        },
        "currency_pair": {
          "$ref": "#/$defs/CurrencyPair"
        },
        "instrument": {
          "$ref": "#/$defs/HedgingInstrument"
        },
        "isda_master": {
          "anyOf": [
            {
              "$ref": "#/$defs/PathRef"
            },
            {
              "type": "null"
            }
          ],
          "description": "PathRef into the ISDA Master Agreement when applicable."
        },
        "mark_to_market": {
          "$ref": "#/$defs/MonetaryAmount"
        },
        "notional": {
          "$ref": "#/$defs/MonetaryAmount"
        },
        "settlement_date": {
          "$ref": "#/$defs/IsoDate"
        },
        "strike_rate": {
          "format": "double",
          "type": [
            "number",
            "null"
          ]
        },
        "trade_date": {
          "$ref": "#/$defs/IsoDate"
        }
      },
      "required": [
        "instrument",
        "notional",
        "currency_pair",
        "trade_date",
        "settlement_date",
        "counterparty",
        "mark_to_market"
      ],
      "type": "object"
    },
    "HedgingInstrument": {
      "description": "Approved hedging-instrument variants.",
      "oneOf": [
        {
          "enum": [
            "forward",
            "option",
            "collar",
            "swap"
          ],
          "type": "string"
        },
        {
          "const": "ndf",
          "description": "Non-deliverable forward (offshore currencies).",
          "type": "string"
        },
        {
          "const": "natural_hedge_only",
          "description": "No derivatives; rely on natural-hedge offsets (matched-currency\ninflows and outflows).",
          "type": "string"
        }
      ]
    },
    "Ifrs9Classification": {
      "description": "IFRS 9 hedge classification.",
      "oneOf": [
        {
          "const": "fair_value_hedge",
          "description": "Hedge of fair-value changes on a recognised asset / liability.",
          "type": "string"
        },
        {
          "const": "cash_flow_hedge",
          "description": "Hedge of cash-flow variability on a forecast transaction.",
          "type": "string"
        },
        {
          "const": "net_investment_hedge",
          "description": "Hedge of net investment in a foreign operation.",
          "type": "string"
        },
        {
          "const": "no_designation",
          "description": "Derivative not designated as a hedge (mark-to-market through\nprofit / loss).",
          "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"
    },
    "MonetaryAmount": {
      "description": "A monetary value with currency.",
      "properties": {
        "amount": {
          "format": "double",
          "type": "number"
        },
        "currency": {
          "$ref": "#/$defs/IsoCurrency"
        }
      },
      "required": [
        "amount",
        "currency"
      ],
      "type": "object"
    },
    "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"
    }
  },
  "$id": "https://corpospec.com/schemas/v0.16.0/fx-exposure.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "FX exposure measurement record.",
  "properties": {
    "as_of": {
      "$ref": "#/$defs/IsoDate"
    },
    "currency_pair": {
      "$ref": "#/$defs/CurrencyPair"
    },
    "derivatives": {
      "items": {
        "$ref": "#/$defs/FxDerivative"
      },
      "type": "array"
    },
    "entity": {
      "$ref": "#/$defs/PathRef"
    },
    "gross_exposure": {
      "$ref": "#/$defs/MonetaryAmount"
    },
    "hedged_amount": {
      "$ref": "#/$defs/MonetaryAmount"
    },
    "id": {
      "$ref": "#/$defs/PathRef"
    },
    "ifrs9_classification": {
      "anyOf": [
        {
          "$ref": "#/$defs/Ifrs9Classification"
        },
        {
          "type": "null"
        }
      ]
    },
    "net_exposure": {
      "$ref": "#/$defs/MonetaryAmount"
    },
    "note": {
      "type": [
        "string",
        "null"
      ]
    },
    "pl_to_date": {
      "$ref": "#/$defs/MonetaryAmount",
      "description": "Cumulative FX P&L for the reporting period."
    },
    "unhedged_amount": {
      "$ref": "#/$defs/MonetaryAmount"
    },
    "var_95": {
      "anyOf": [
        {
          "$ref": "#/$defs/MonetaryAmount"
        },
        {
          "type": "null"
        }
      ],
      "description": "95% one-day Value-at-Risk on the unhedged exposure."
    }
  },
  "required": [
    "id",
    "entity",
    "as_of",
    "currency_pair",
    "gross_exposure",
    "net_exposure",
    "hedged_amount",
    "unhedged_amount",
    "pl_to_date"
  ],
  "title": "FxExposure",
  "type": "object",
  "x-corpospec-pillar": "financials"
}