{ "swagger": "2.0", "info": { "title": "1Mao API", "contact": {}, "version": "1.0" }, "paths": { "/bookings": { "post": { "security": [ { "ApiKeyAuth": [] } ], "description": "Cria um novo agendamento entre cliente e profissional", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Bookings" ], "summary": "Cria um novo agendamento", "parameters": [ { "type": "string", "description": "Token de autenticação (Bearer token)", "name": "Authorization", "in": "header", "required": true } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/service.BookingResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/bookings/client": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "Retorna a lista de agendamentos de um cliente específico", "produces": [ "application/json" ], "tags": [ "Bookings" ], "summary": "Lista agendamentos do cliente", "parameters": [ { "type": "string", "description": "Token de autenticação (Bearer token)", "name": "Authorization", "in": "header", "required": true }, { "type": "integer", "description": "ID do cliente", "name": "client_id", "in": "query", "required": true }, { "type": "string", "description": "Data inicial (YYYY-MM-DD)", "name": "from", "in": "query" }, { "type": "string", "description": "Data final (YYYY-MM-DD)", "name": "to", "in": "query" }, { "type": "string", "description": "Status do agendamento", "name": "status", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/service.BookingResponse" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/bookings/professional": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "Retorna a lista de agendamentos de um profissional", "produces": [ "application/json" ], "tags": [ "Bookings" ], "summary": "Lista agendamentos do profissional", "parameters": [ { "type": "string", "description": "Token de autenticação (Bearer token)", "name": "Authorization", "in": "header", "required": true }, { "type": "string", "description": "Data final (YYYY-MM-DD)", "name": "to", "in": "query" }, { "type": "string", "description": "Status do agendamento", "name": "status", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/service.BookingResponse" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/bookings/{id}": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "Retorna os detalhes de um agendamento específico", "produces": [ "application/json" ], "tags": [ "Bookings" ], "summary": "Obtém um agendamento", "parameters": [ { "type": "string", "description": "Token de autenticação (Bearer token)", "name": "Authorization", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/service.BookingResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/bookings/{id}/status": { "put": { "security": [ { "ApiKeyAuth": [] } ], "description": "Atualiza o status de um agendamento existente", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Bookings" ], "summary": "Atualiza status do agendamento", "parameters": [ { "type": "string", "description": "Token de autenticação (Bearer token)", "name": "Authorization", "in": "header", "required": true }, { "description": "Novo status", "name": "status", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handlers.UpdateStatusRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/service.BookingResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/chat/messages": { "get": { "description": "Retorna o histórico de mensagens entre usuários", "produces": [ "application/json" ], "tags": [ "Chat" ], "summary": "Buscar mensagens de chat", "parameters": [ { "type": "integer", "example": 1, "description": "ID do remetente", "name": "sender_id", "in": "query", "required": true }, { "enum": [ "client", "professional" ], "type": "string", "description": "Tipo do remetente", "name": "sender_type", "in": "query", "required": true }, { "type": "integer", "example": 2, "description": "ID do destinatário", "name": "receiver_id", "in": "query", "required": true }, { "enum": [ "client", "professional" ], "type": "string", "description": "Tipo do destinatário", "name": "receiver_type", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Message" } } } } } }, "/client/login": { "post": { "description": "Autentica um cliente e retorna token JWT", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "Login de cliente", "parameters": [ { "description": "Credenciais de login", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_client_delivery_httpa.LoginRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/httpa.LoginResponse" } }, "400": { "description": "Requisição inválida", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "401": { "description": "Credenciais inválidas", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/client/me": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "Retorna os dados do cliente autenticado", "tags": [ "Clients" ], "summary": "Obter perfil do cliente", "parameters": [ { "type": "string", "description": "Token de autenticação (Bearer token)", "name": "Authorization", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.Client" } }, "401": { "description": "Não autorizado", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/client/register": { "post": { "description": "Cria uma nova conta de cliente", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Clients" ], "summary": "Registrar novo cliente", "parameters": [ { "description": "Dados do cliente", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_client_delivery_httpa.RegisterRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/domain.Client" } }, "400": { "description": "Dados inválidos", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Erro interno", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/client/users": { "get": { "description": "Retorna uma lista com todos os usuários cadastrados no sistema", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Clients" ], "summary": "Listar todos os usuários", "responses": { "200": { "description": "Lista de usuários", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Client" } } }, "401": { "description": "Token inválido ou não fornecido", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "403": { "description": "Acesso negado", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Erro interno ao processar a requisição", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/professional/login": { "post": { "description": "Autentica um profissional e retorna um token JWT", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "Login de profissional", "parameters": [ { "description": "Credenciais de login", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_professional_delivery_httpa.LoginRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/professional/register": { "post": { "description": "Cria uma nova conta de profissional", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Professionals" ], "summary": "Registrar novo profissional", "parameters": [ { "description": "Dados do profissional", "name": "professional", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_professional_delivery_httpa.RegisterRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/domain.Professional" } }, "400": { "description": "Dados inválidos", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Erro interno", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/professional/{id}": { "get": { "description": "Retorna os detalhes de um profissional específico", "produces": [ "application/json" ], "tags": [ "Professionals" ], "summary": "Obter profissional por ID", "parameters": [ { "type": "integer", "description": "ID do profissional", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.Professional" } }, "400": { "description": "ID inválido", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "Profissional não encontrado", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/professionals": { "get": { "description": "Retorna uma lista com todos os profissionais cadastrados", "produces": [ "application/json" ], "tags": [ "Professionals" ], "summary": "Listar todos os profissionais", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Professional" } } }, "500": { "description": "Erro interno", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } } }, "definitions": { "domain.BookingStatus": { "type": "string", "enum": [ "pending", "confirmed", "cancelled", "completed" ], "x-enum-varnames": [ "StatusPending", "StatusConfirmed", "StatusCancelled", "StatusCompleted" ] }, "domain.Client": { "description": "Modelo completo de cliente", "type": "object", "properties": { "email": { "type": "string" }, "id": { "type": "integer" }, "last_login": { "type": "string" }, "name": { "type": "string" }, "phone": { "type": "string" }, "role": { "$ref": "#/definitions/domain.Role" } } }, "domain.Message": { "description": "Estrutura completa de mensagem com metadados", "type": "object", "properties": { "content": { "type": "string", "example": "Olá, como posso ajudar?" }, "created_at": { "type": "string", "example": "2023-01-01T00:00:00Z" }, "id": { "type": "integer", "example": 1 }, "receiver_id": { "type": "integer", "example": 2 }, "receiver_type": { "type": "string", "enum": [ "client", "professional" ], "example": "professional" }, "sender_id": { "type": "integer", "example": 1 }, "sender_type": { "type": "string", "enum": [ "client", "professional" ], "example": "client" }, "timestamp": { "type": "string", "example": "2023-01-01T15:04:05Z" }, "updated_at": { "type": "string", "example": "2023-01-01T00:00:00Z" } } }, "domain.Professional": { "description": "Modelo completo de profissional", "type": "object", "properties": { "created_at": { "type": "string" }, "email": { "type": "string" }, "experience": { "type": "integer" }, "id": { "type": "integer" }, "name": { "type": "string" }, "profession": { "type": "string" }, "rating": { "type": "number" }, "updated_at": { "type": "string" }, "verified": { "type": "boolean" } } }, "domain.Role": { "type": "string", "enum": [ "client", "professional" ], "x-enum-varnames": [ "RoleClient", "RoleProfessional" ] }, "handlers.ErrorResponse": { "type": "object", "properties": { "error": { "description": "Mensagem de erro\n@Example Resource not found", "type": "string" } } }, "handlers.UpdateStatusRequest": { "type": "object", "properties": { "status": { "description": "Novo status do agendamento\n@Enum pending,confirmed,cancelled,completed\n@Example confirmed", "type": "string" } } }, "httpa.LoginResponse": { "description": "Retorno do endpoint de login contendo o token JWT", "type": "object", "properties": { "token": { "type": "string", "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." } } }, "internal_client_delivery_httpa.LoginRequest": { "description": "Credenciais para autenticação do cliente", "type": "object", "properties": { "email": { "type": "string", "example": "cliente@example.com" }, "password": { "type": "string", "example": "senhaSegura123" } } }, "internal_client_delivery_httpa.RegisterRequest": { "description": "Dados necessários para registrar um novo cliente", "type": "object", "properties": { "email": { "type": "string", "example": "cliente@example.com" }, "name": { "type": "string", "example": "João Silva" }, "password": { "type": "string", "example": "senhaSegura123" }, "phone": { "type": "string", "example": "+5511999999999" } } }, "internal_professional_delivery_httpa.LoginRequest": { "description": "Credenciais para autenticação do cliente", "type": "object", "properties": { "email": { "type": "string", "example": "cliente@example.com" }, "password": { "type": "string", "example": "senhaSegura123" } } }, "internal_professional_delivery_httpa.RegisterRequest": { "description": "Dados necessários para registrar um novo cliente", "type": "object", "properties": { "email": { "type": "string", "example": "cliente@example.com" }, "name": { "type": "string", "example": "João Silva" }, "password": { "type": "string", "example": "senhaSegura123" }, "phone": { "type": "string", "example": "+5511999999999" } } }, "service.BookingResponse": { "type": "object", "properties": { "client_id": { "type": "integer" }, "created_at": { "type": "string" }, "end_time": { "type": "string" }, "id": { "type": "integer" }, "professional_id": { "type": "integer" }, "start_time": { "type": "string" }, "status": { "$ref": "#/definitions/domain.BookingStatus" }, "updated_at": { "type": "string" } } } } }