export default {
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "enum": [
        "buy",
        "sell"
      ],
      "description": "Is this order a buy or sell?"
    },
    "owner": {
      "type": "string"
    },
    "sellToken": {
      "type": "string",
      "description": "ERC-20 token to be sold."
    },
    "sellTokenDecimals": {
      "type": "number"
    },
    "buyToken": {
      "type": "string",
      "description": "ERC-20 token to be bought."
    },
    "buyTokenDecimals": {
      "type": "number"
    },
    "env": {
      "type": "string",
      "enum": [
        "prod",
        "staging"
      ],
      "description": "The environment to use for the Cow API."
    },
    "partiallyFillable": {
      "type": "boolean",
      "description": "Is the order fill-or-kill or partially fillable?"
    },
    "slippageBps": {
      "type": "number",
      "description": "Slippage in basis points. If not provided, it will use AUTO slippage, which would suggest a slippage based on the quote."
    },
    "receiver": {
      "anyOf": [
        {
          "type": "string",
          "description": "20 byte Ethereum address encoded as a hex with `0x` prefix."
        },
        {
          "type": "null"
        }
      ],
      "description": "An optional Ethereum address to receive the proceeds of the trade instead of the owner (i.e. the order signer)."
    },
    "validFor": {
      "type": "number",
      "description": "Unix timestamp (`uint32`) until which the order is valid."
    },
    "partnerFee": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "volumeBps": {
                    "type": "number",
                    "description": "The fee in basis points (BPS) to be paid to the partner based on volume. Capped at protocol level to 100 BPS (1%)"
                  },
                  "recipient": {
                    "type": "string",
                    "description": "The Ethereum address of the partner to receive the fee."
                  }
                },
                "required": [
                  "volumeBps",
                  "recipient"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "surplusBps": {
                    "type": "number",
                    "description": "The fee in basis points (BPS) to be paid to the partner based on surplus"
                  },
                  "maxVolumeBps": {
                    "type": "number",
                    "description": "The maximum volume in basis points (BPS) to be paid to the partner. Capped at protocol level to 100 BPS (1%). You can chose to go lower but not higher"
                  },
                  "recipient": {
                    "type": "string",
                    "description": "The Ethereum address of the partner to receive the fee."
                  }
                },
                "required": [
                  "surplusBps",
                  "maxVolumeBps",
                  "recipient"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "priceImprovementBps": {
                    "type": "number",
                    "description": "The fee in basis points (BPS) to be paid to the partner based on price improvement"
                  },
                  "maxVolumeBps": {
                    "type": "number",
                    "description": "The maximum volume in basis points (BPS) to be paid to the partner. Capped at protocol level to 100 BPS (1%). You can chose to go lower but not higher"
                  },
                  "recipient": {
                    "type": "string",
                    "description": "The Ethereum address of the partner to receive the fee."
                  }
                },
                "required": [
                  "priceImprovementBps",
                  "maxVolumeBps",
                  "recipient"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        {
          "type": "object",
          "properties": {
            "volumeBps": {
              "type": "number",
              "description": "The fee in basis points (BPS) to be paid to the partner based on volume. Capped at protocol level to 100 BPS (1%)"
            },
            "recipient": {
              "type": "string",
              "description": "The Ethereum address of the partner to receive the fee."
            }
          },
          "required": [
            "volumeBps",
            "recipient"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "surplusBps": {
              "type": "number",
              "description": "The fee in basis points (BPS) to be paid to the partner based on surplus"
            },
            "maxVolumeBps": {
              "type": "number",
              "description": "The maximum volume in basis points (BPS) to be paid to the partner. Capped at protocol level to 100 BPS (1%). You can chose to go lower but not higher"
            },
            "recipient": {
              "type": "string",
              "description": "The Ethereum address of the partner to receive the fee."
            }
          },
          "required": [
            "surplusBps",
            "maxVolumeBps",
            "recipient"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "priceImprovementBps": {
              "type": "number",
              "description": "The fee in basis points (BPS) to be paid to the partner based on price improvement"
            },
            "maxVolumeBps": {
              "type": "number",
              "description": "The maximum volume in basis points (BPS) to be paid to the partner. Capped at protocol level to 100 BPS (1%). You can chose to go lower but not higher"
            },
            "recipient": {
              "type": "string",
              "description": "The Ethereum address of the partner to receive the fee."
            }
          },
          "required": [
            "priceImprovementBps",
            "maxVolumeBps",
            "recipient"
          ],
          "additionalProperties": false
        }
      ]
    },
    "sellAmount": {
      "type": "string",
      "description": "Amount of `sellToken` to be sold in atoms."
    },
    "buyAmount": {
      "type": "string",
      "description": "Amount of `buyToken` to be bought in atoms."
    },
    "quoteId": {
      "type": "number",
      "description": "Id of the quote to be used for the limit order."
    },
    "validTo": {
      "type": "number",
      "description": "Unix timestamp (`uint32`) until which the order is valid."
    }
  },
  "required": [
    "buyAmount",
    "buyToken",
    "buyTokenDecimals",
    "kind",
    "sellAmount",
    "sellToken",
    "sellTokenDecimals"
  ],
  "additionalProperties": false,
  "definitions": {}
} as const