{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/grainfinance-co/main/json-schema/grainfinance-co-created-customer-hedge-proposal-response-body-schema.json",
  "title": "CreatedCustomerHedgeProposalResponseBody",
  "x-generated": "2026-10-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/grainfinance-co-openapi.yaml#/components/schemas/CreatedCustomerHedgeProposalResponseBody",
  "properties": {
    "id": {
      "$ref": "#/$defs/UUID",
      "description": "The id of the hedge proposal within the Grain platform."
    },
    "contractType": {
      "anyOf": [
        {
          "$ref": "#/$defs/HedgeContractType.Flexible"
        },
        {
          "$ref": "#/$defs/HedgeContractType.Standard"
        }
      ],
      "description": "The contract type of the proposed hedge.\nOnly present when the proposal is for a flexible or standard hedge."
    },
    "fixedSide": {
      "$ref": "#/$defs/DisplayFixedSide",
      "description": "Indicates which currency amount was fixed (specified) when creating the quote.\nWhen `fixedSide` is `toCurrencyAmount`, the `toCurrencyAmount` was specified and `fromCurrencyAmount` was calculated.\nWhen `fixedSide` is `fromCurrencyAmount`, the `fromCurrencyAmount` was specified and `toCurrencyAmount` was calculated.\nOnly present if an amount was provided at quote time."
    },
    "fromCurrency": {
      "type": "string",
      "description": "The currency in which the transaction should be paid at by your customer."
    },
    "toCurrency": {
      "type": "string",
      "description": "The currency in which the inventory item is listed at on your platform."
    },
    "fromCurrencyAmount": {
      "type": "number",
      "format": "double",
      "description": "The amount to hedge in the fromCurrency.\nIf toCurrencyAmount is provided, then fromCurrencyAmount calculated as:\n`fromCurrencyAmount = toCurrencyAmount * quote`\nOnly present if an amount was provided at quote time."
    },
    "toCurrencyAmount": {
      "type": "number",
      "format": "double",
      "description": "The amount to hedge in the toCurrency.\nIf fromCurrencyAmount is provided, then toCurrencyAmount calculated as:\n`toCurrencyAmount = fromCurrencyAmount / quote`\nOnly present if an amount was provided at quote time."
    },
    "quote": {
      "type": "number",
      "format": "double",
      "description": "The rate locked by this hedge."
    },
    "endAt": {
      "$ref": "#/$defs/GrainDateFormat",
      "description": "The date in which the hedge will be settled, denoted in `YYYY-MM-DD` format."
    },
    "settlementAt": {
      "description": "The date in which the hedge begins settlement, denoted in `YYYY-MM-DD` format.",
      "oneOf": [
        {
          "$ref": "#/$defs/GrainDateFormat"
        },
        {
          "type": "null"
        }
      ]
    },
    "validUntilTs": {
      "type": "number",
      "format": "double",
      "description": "The unix timestamp until which the hedge offer is valid."
    },
    "initialCollateralPercentage": {
      "type": "number",
      "format": "double",
      "description": "The percentage from the overall amount of collateral required to perform this hedge at inception."
    },
    "externalMarkupPct": {
      "type": [
        "number",
        "null"
      ],
      "format": "double",
      "description": "The external markup percentage that should be added to this quote on top of Grain's internal pricing.\nFor example, a value of 1.0 represents a 1.0% additional markup."
    }
  },
  "required": [
    "id",
    "fromCurrency",
    "toCurrency",
    "quote",
    "endAt",
    "settlementAt",
    "validUntilTs",
    "initialCollateralPercentage",
    "externalMarkupPct"
  ],
  "type": "object",
  "additionalProperties": false,
  "$defs": {
    "DisplayFixedSide": {
      "description": "The fixed side as displayed in external APIs (camelCase format).\nIndicates which currency amount was specified when creating the hedge.",
      "enum": [
        "toCurrencyAmount",
        "fromCurrencyAmount"
      ],
      "type": "string"
    },
    "GrainDateFormat": {
      "type": "string",
      "format": "YYYY-MM-DD",
      "description": "The date format accepted by Grain's API. We accept dash separated ISO-8601 date-only strings.",
      "pattern": "\\d{4}-\\d{2}-\\d{2}"
    },
    "HedgeContractType.Flexible": {
      "enum": [
        "flexible"
      ],
      "type": "string"
    },
    "HedgeContractType.Standard": {
      "enum": [
        "standard"
      ],
      "type": "string"
    },
    "UUID": {
      "type": "string",
      "format": "uuid",
      "pattern": "[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}"
    }
  }
}