{
  "openapi": "3.0.0",
  "info": {
    "title": "Rewards",
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "1.0.0"
  },
  "paths": {
    "/v1.0.0/rewards/health": {
      "$ref": "../Http/schema.json#/paths/Health"
    },
    "/v1.0.0/rewards/account-balance": {
      "post": {
        "summary": "Rewards balance search",
        "operationId": "balanceSearch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BalanceSearchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Rewards balance of given account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BigInt"
                }
              }
            }
          },
          "400": {
            "description": "invalid request"
          }
        }
      }
    },
    "/v1.0.0/rewards/history": {
      "post": {
        "summary": "Rewards history search",
        "operationId": "rewardsHistorySearch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RewardHistoryProps"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Rewards per epoch fetched",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HistorySearchResponse"
                }
              }
            }
          },
          "400": {
            "description": "invalid request"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "BigInt": {
        "required": ["value", "__type"],
        "type": "object",
        "properties": {
          "value": {
            "type": "string"
          },
          "__type": {
            "type": "string",
            "enum": ["bigint"]
          }
        }
      },
      "Map": {
        "required": ["value", "__type"],
        "type": "object",
        "properties": {
          "value": {
            "type": "array"
          },
          "__type": {
            "type": "string",
            "enum": ["Map"]
          }
        }
      },
      "HistorySearchResponse": {
        "$ref": "#/components/schemas/Map"
      },
      "BalanceSearchRequest": {
        "type": "object",
        "required": ["rewardAccount"],
        "properties": {
          "rewardAccount": {
            "$ref": "#/components/schemas/RewardAccount"
          }
        }
      },
      "RewardHistoryProps": {
        "type": "object",
        "required": ["rewardAccounts"],
        "properties": {
          "rewardAccounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RewardAccount"
            }
          },
          "epochs": {
            "$ref": "#/components/schemas/EpochRange"
          }
        }
      },
      "EpochRange": {
        "type": "object",
        "properties": {
          "lowerBound": {
            "type": "number"
          },
          "upperBound": {
            "type": "number"
          }
        }
      },
      "RewardAccount": {
        "type": "string"
      }
    }
  }
}
