{
  "openapi": "3.0.1",
  "info": {
    "title": "Model Listing",
    "version": "1.0.0",
    "description": "API to list user models with pagination support."
  },
   "servers": [
    {
      "url": "https://models.fineshare.net",
      "description": "Models"
    }
  ],
  "paths": {
    "/api/models/list": {
      "get": {
        "summary": "List user models",
        "operationId": "ListMyModels",
        "tags": ["Model Management"],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "example": 1
            },
            "description": "The page number for pagination."
          },
          {
            "name": "limit",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "example": 10
            },
            "description": "The number of models per page."
          },
          {
            "name": "Authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Bearer token for authorization."
          }
        ],
        "responses": {
          "200": {
            "description": "List of user models.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListMyModelRespModel"
                },
                "examples": {
                  "example-1": {
                    "summary": "Successful Response",
                    "value": {
                      "status": "success",
                      "models": [
                        {
                          "modelId": "123e4567-e89b-12d3-a456-426614174000",
                          "name": "VoiceModel1",
                          "languageCode": "en-US",
                          "gender": "male",
                          "creationDate": "2024-11-20T12:34:56Z"
                        },
                        {
                          "modelId": "223e4567-e89b-12d3-a456-426614174001",
                          "name": "VoiceModel2",
                          "languageCode": "en-UK",
                          "gender": "female",
                          "creationDate": "2024-11-19T08:22:10Z"
                        }
                      ],
                      "pagination": {
                        "currentPage": 1,
                        "totalPages": 5,
                        "totalItems": 50
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            }
          },
          "500": {
            "description": "Server error - unable to process the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ListMyModelRespModel": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "success"
          },
          "models": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "modelId": {
                  "type": "string",
                  "example": "123e4567-e89b-12d3-a456-426614174000"
                },
                "name": {
                  "type": "string",
                  "example": "VoiceModel1"
                },
                "languageCode": {
                  "type": "string",
                  "example": "en-US"
                },
                "gender": {
                  "type": "string",
                  "example": "male"
                },
                "creationDate": {
                  "type": "string",
                  "format": "date-time",
                  "example": "2024-11-20T12:34:56Z"
                }
              }
            }
          },
          "pagination": {
            "type": "object",
            "properties": {
              "currentPage": {
                "type": "integer",
                "example": 1
              },
              "totalPages": {
                "type": "integer",
                "example": 5
              },
              "totalItems": {
                "type": "integer",
                "example": 50
              }
            }
          }
        }
      },
      "ErrorModel": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "example": "Invalid pagination parameters."
          },
          "details": {
            "type": "string",
            "example": "The 'page' parameter must be greater than 0."
          }
        }
      }
    }
  }
}

