{
  "swagger": "2.0",
  "info": {
    "description": "This is the API Gateway for the Biometry Services.",
    "title": "Biometry API Gateway",
    "version": "1.0"
  },
  "basePath": "",
  "paths": {
    "/api-gateway/enroll/face": {
      "post": {
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "description": "Enroll face for face recognition. You have to come up with a unique_id",
        "consumes": ["multipart/form-data"],
        "produces": ["application/json"],
        "tags": ["enroll"],
        "summary": "Enroll face",
        "parameters": [
          {
            "type": "string",
            "description": "Unique ID",
            "name": "unique_id",
            "in": "formData",
            "required": true
          },
          {
            "type": "string",
            "description": "Person name",
            "name": "person_name",
            "in": "formData"
          },
          {
            "type": "file",
            "description": "Face image",
            "name": "face",
            "in": "formData",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/rest.stdResponse"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "$ref": "#/definitions/rest.stdError"
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "$ref": "#/definitions/rest.stdError"
            }
          }
        }
      }
    },
    "/api-gateway/enroll/voice": {
      "post": {
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "description": "Enroll voice for voice recognition. This endpoint requires a Bearer jwt token in the Authorization header.",
        "consumes": ["multipart/form-data"],
        "produces": ["application/json"],
        "tags": ["enroll"],
        "summary": "Enroll voice",
        "parameters": [
          {
            "type": "string",
            "description": "Unique ID",
            "name": "unique_id",
            "in": "formData",
            "required": true
          },
          {
            "type": "string",
            "description": "Phrase. It should be the same as the phrase in the video",
            "name": "phrase",
            "in": "formData",
            "required": true
          },
          {
            "type": "string",
            "description": "Vocabulary",
            "name": "vocabulary",
            "in": "formData"
          },
          {
            "type": "file",
            "description": "Voice file",
            "name": "voice",
            "in": "formData",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/rest.stdResponse"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "$ref": "#/definitions/rest.stdError"
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "$ref": "#/definitions/rest.stdError"
            }
          }
        }
      }
    },
    "/api-gateway/process-video": {
      "post": {
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "description": "Process video and return the result. This endpoint requires a Bearer jwt token in the Authorization header.",
        "consumes": ["multipart/form-data"],
        "produces": ["application/json"],
        "tags": ["login"],
        "summary": "Process video",
        "parameters": [
          {
            "type": "file",
            "description": "Video file",
            "name": "video",
            "in": "formData",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/models.GatewayProcessVideoResponse200"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "$ref": "#/definitions/rest.stdError"
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "$ref": "#/definitions/rest.stdError"
            }
          }
        }
      }
    },
    "/api-transactions/transactions/{id}/samples": {
      "get": {
        "description": "Get transaction samples",
        "consumes": ["application/json"],
        "produces": ["application/json"],
        "tags": ["transactions"],
        "summary": "Get transaction samples",
        "parameters": [
          {
            "type": "string",
            "description": "Transaction ID",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/rest.stdResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/models.GetSamplesResponse200"
                    }
                  }
                }
              ]
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "type": "string"
            }
          }
        }
      }
    },
    "/api-transactions/transactions/{id}/flag": {
      "put": {
          "description": "Flag transaction",
          "consumes": [
              "application/json"
          ],
          "produces": [
              "application/json"
          ],
          "tags": [
              "transactions"
          ],
          "summary": "Flag transaction",
          "parameters": [
              {
                  "type": "string",
                  "description": "Transaction ID",
                  "name": "id",
                  "in": "path",
                  "required": true
              },
              {
                  "type": "string",
                  "description": "Flag",
                  "name": "flag",
                  "in": "query",
                  "required": true
              }
          ],
          "responses": {
              "200": {
                  "description": "OK",
                  "schema": {
                      "allOf": [
                          {
                              "$ref": "#/definitions/rest.stdResponse"
                          },
                          {
                              "type": "object",
                              "properties": {
                                  "message": {
                                      "type": "string"
                                  }
                              }
                          }
                      ]
                  }
              },
              "400": {
                  "description": "Bad Request",
                  "schema": {
                      "allOf": [
                          {
                              "$ref": "#/definitions/rest.stdResponse"
                          },
                          {
                              "type": "object",
                              "properties": {
                                  "error": {
                                      "type": "string"
                                  }
                              }
                          }
                      ]
                  }
              }
          }
      }
  },
    "/api-consent/consent": {
      "post": {
        "security": [
          {
            "Bearer": []
          }
        ],
        "description": "You can give consent for a given users name",
        "consumes": ["application/json"],
        "produces": ["application/json"],
        "tags": ["consent"],
        "summary": "Give consent",
        "parameters": [
          {
            "description": "consent",
            "name": "consent",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/rest.CreateConsentRequest"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "schema": {
              "$ref": "#/definitions/rest.stdResponse"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "$ref": "#/definitions/rest.stdResponse"
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "$ref": "#/definitions/rest.stdResponse"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "rest.stdResponse": {
      "type": "object",
      "properties": {
        "data": {},
        "message": {
          "type": "string"
        },
        "result_conditions": {}
      }
    },
    "rest.GetConsentRequest": {
      "type": "object",
      "required": ["user_fullname"],
      "properties": {
        "user_fullname": {
          "type": "string"
        }
      }
    },
    "rest.stdError": {
      "type": "object",
      "properties": {
        "error": {}
      }
    },
    "models.GetSamplesResponse200": {
      "type": "object",
      "properties": {
        "login_extracted_audio": {
          "type": "string"
        },
        "login_extracted_frame": {
          "type": "string"
        },
        "login_original_video": {
          "type": "string"
        }
      }
    },
    "rest.CreateConsentRequest": {
      "type": "object",
      "required": ["is_consent_given", "user_fullname"],
      "properties": {
        "is_consent_given": {
          "type": "boolean"
        },
        "user_fullname": {
          "type": "string",
          "minLength": 3
        }
      }
    },
    "models.GatewayProcessVideoResponse200": {
      "type": "object",
      "properties": {
        "data": {
          "type": "object",
          "properties": {
            "Face Recognition": {
              "$ref": "#/definitions/models.faceRecognitionResponse"
            }
          }
        },
        "message": {
          "type": "string"
        },
        "result_conditions": {}
      }
    },
    "models.faceRecognitionResponse": {
      "type": "object",
      "properties": {
        "instances": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/models.faceRecognitionInstance"
          }
        }
      }
    },
    "models.faceRecognitionInstance": {
      "type": "object",
      "properties": {
        "abstractFaceId": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "siteId": {},
            "type": {
              "type": "string"
            }
          }
        },
        "eyes": {
          "type": "object",
          "properties": {
            "left": {
              "$ref": "#/definitions/models.EyeDetail"
            },
            "right": {
              "$ref": "#/definitions/models.EyeDetail"
            }
          }
        },
        "nose": {
          "$ref": "#/definitions/models.PointDetail"
        },
        "mouth": {
          "type": "object",
          "properties": {
            "left": {
              "$ref": "#/definitions/models.EyeDetail"
            },
            "right": {
              "$ref": "#/definitions/models.EyeDetail"
            }
          }
        },
        "quality": {
          "type": "number"
        },
        "blurriness": {
          "type": "number"
        }
      }
    },
    "models.EyeDetail": {
      "type": "object",
      "properties": {
        "isEmpty": {
          "type": "boolean"
        },
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        }
      }
    },
    "models.PointDetail": {
      "type": "object",
      "properties": {
        "isEmpty": {
          "type": "boolean"
        },
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        }
      }
    }
  },
  "securityDefinitions": {
    "ApiKeyAuth": {
      "type": "apiKey",
      "name": "Authorization",
      "in": "header"
    }
  }
}
