{
    "openapi": "3.0.0",
    "info": {
        "title": "FGCTIC API",
        "description": "API REST FGCTIC: inscrição pública, JWT (tymon/jwt-auth), admin com permissão view inscricoes. Regras condicionais na operação POST /api/inscricao.",
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "/",
            "description": "Servidor (ajuste conforme APP_URL)"
        }
    ],
    "paths": {
        "/api/auth/login": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Login (JWT)",
                "description": "Autentica com e-mail e senha. Retorna `access_token` para uso no header `Authorization: Bearer ...`.",
                "operationId": "authLogin",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/LoginRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Token emitido",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/JwtTokenResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Credenciais inválidas",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MessageResponse"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validação",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/auth/register": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Registro de usuário",
                "description": "Cria conta com role padrão `user`. Retorna JWT. Para acessar listagem de inscrições é necessário role `admin` e permissão `view inscricoes`.",
                "operationId": "authRegister",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/RegisterRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Conta criada + token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/JwtTokenResponse"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validação (ex.: e-mail já usado)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/auth/logout": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Logout",
                "description": "Invalida o token JWT atual.",
                "operationId": "authLogout",
                "responses": {
                    "200": {
                        "description": "Logout OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MessageResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Não autenticado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/auth/me": {
            "get": {
                "tags": [
                    "Auth"
                ],
                "summary": "Usuário autenticado",
                "description": "Retorna dados do usuário, roles e permissões.",
                "operationId": "authMe",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AuthMeResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Token ausente ou inválido"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/inscricao": {
            "post": {
                "tags": [
                    "Inscrição pública"
                ],
                "summary": "Registrar inscrição",
                "description": "Endpoint público do formulário. Aceita também `serMonito` ou `precisaMonitor` no lugar de `serMonitor`.",
                "operationId": "inscricaoStore",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/InscricaoRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Inscrição criada",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/InscricaoCreated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validação ou e-mail já cadastrado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Erro interno",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MessageResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/inscricoes": {
            "get": {
                "tags": [
                    "Admin — Inscrições"
                ],
                "summary": "Listar inscrições (admin)",
                "description": "Paginação Laravel. Requer JWT e permissão Spatie **`view inscricoes`** (ex.: utilizador com role `admin`).",
                "operationId": "inscricoesIndex",
                "parameters": [
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Itens por página (1–100, padrão 15)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 15,
                            "maximum": 100,
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Lista paginada",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/InscricoesPaginated"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Não autenticado"
                    },
                    "403": {
                        "description": "Sem permissão `view inscricoes`"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "InscricaoRequest": {
                "required": [
                    "nome",
                    "email",
                    "telefone",
                    "cep",
                    "numero",
                    "formadoFormando",
                    "curso",
                    "querMonitor",
                    "serMonitor"
                ],
                "properties": {
                    "nome": {
                        "type": "string",
                        "example": "Fulano da Silva"
                    },
                    "email": {
                        "type": "string",
                        "format": "email"
                    },
                    "telefone": {
                        "type": "string",
                        "example": "+55 (11) 99999-9999"
                    },
                    "cep": {
                        "type": "string",
                        "example": "01310-100"
                    },
                    "logradouro": {
                        "type": "string",
                        "nullable": true
                    },
                    "cidade": {
                        "type": "string",
                        "nullable": true
                    },
                    "estado": {
                        "type": "string",
                        "example": "SP",
                        "nullable": true,
                        "maxLength": 2
                    },
                    "numero": {
                        "type": "string",
                        "example": "1000"
                    },
                    "complemento": {
                        "type": "string",
                        "nullable": true
                    },
                    "formadoFormando": {
                        "type": "string",
                        "enum": [
                            "formado",
                            "formando"
                        ]
                    },
                    "curso": {
                        "type": "string",
                        "example": "Ciência da Computação"
                    },
                    "areaExperiencia": {
                        "type": "string",
                        "nullable": true
                    },
                    "tempoExperiencia": {
                        "type": "string",
                        "nullable": true
                    },
                    "querMonitor": {
                        "description": "Deseja ser monitor (voluntário)",
                        "type": "boolean"
                    },
                    "materiasDominio": {
                        "description": "Obrigatório se querMonitor = true",
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "diasMentoria": {
                        "description": "Obrigatório se serMonitor = true — disponibilidade para mentoria",
                        "type": "array",
                        "items": {
                            "properties": {
                                "dia": {
                                    "type": "string",
                                    "example": "Segunda-feira"
                                },
                                "inicio": {
                                    "type": "string",
                                    "example": "14:00"
                                },
                                "fim": {
                                    "type": "string",
                                    "example": "18:00"
                                }
                            },
                            "type": "object"
                        }
                    },
                    "serMonitor": {
                        "description": "Precisa de monitor / acompanhamento",
                        "type": "boolean"
                    },
                    "materiasPrecisaMonitor": {
                        "description": "Obrigatório se serMonitor = true",
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "type": "object"
            },
            "InscricaoCreated": {
                "properties": {
                    "message": {
                        "type": "string",
                        "example": "Inscrição de associado(a) recebida com sucesso."
                    },
                    "id": {
                        "type": "integer",
                        "example": 1
                    }
                },
                "type": "object"
            },
            "ValidationError": {
                "properties": {
                    "message": {
                        "type": "string"
                    },
                    "errors": {
                        "type": "object",
                        "additionalProperties": true
                    }
                },
                "type": "object"
            },
            "LoginRequest": {
                "required": [
                    "email",
                    "password"
                ],
                "properties": {
                    "email": {
                        "type": "string",
                        "format": "email"
                    },
                    "password": {
                        "type": "string",
                        "format": "password"
                    }
                },
                "type": "object"
            },
            "RegisterRequest": {
                "required": [
                    "name",
                    "email",
                    "password",
                    "password_confirmation"
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string",
                        "format": "email"
                    },
                    "password": {
                        "type": "string",
                        "format": "password"
                    },
                    "password_confirmation": {
                        "type": "string",
                        "format": "password"
                    }
                },
                "type": "object"
            },
            "JwtTokenResponse": {
                "properties": {
                    "access_token": {
                        "type": "string"
                    },
                    "token_type": {
                        "type": "string",
                        "example": "bearer"
                    },
                    "expires_in": {
                        "description": "TTL em segundos",
                        "type": "integer"
                    }
                },
                "type": "object"
            },
            "MessageResponse": {
                "properties": {
                    "message": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "AuthMeResponse": {
                "properties": {
                    "user": {
                        "type": "object"
                    },
                    "roles": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "permissions": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "type": "object"
            },
            "MentoriaResource": {
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "inscricao_id": {
                        "type": "integer"
                    },
                    "materias_dominio": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "status": {
                        "type": "string"
                    },
                    "observacao_interna": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "MonitorResource": {
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "inscricao_id": {
                        "type": "integer"
                    },
                    "materias_precisa": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "dias_mentoria": {
                        "type": "array",
                        "items": {
                            "properties": {
                                "dia": {
                                    "type": "string"
                                },
                                "inicio": {
                                    "type": "string"
                                },
                                "fim": {
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        }
                    },
                    "status": {
                        "type": "string"
                    },
                    "observacao_interna": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "InscricaoResource": {
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "telefone": {
                        "type": "string"
                    },
                    "cep": {
                        "type": "string"
                    },
                    "logradouro": {
                        "type": "string",
                        "nullable": true
                    },
                    "cidade": {
                        "type": "string",
                        "nullable": true
                    },
                    "estado": {
                        "type": "string",
                        "nullable": true
                    },
                    "numero": {
                        "type": "string"
                    },
                    "complemento": {
                        "type": "string",
                        "nullable": true
                    },
                    "formado_formando": {
                        "type": "string"
                    },
                    "curso": {
                        "type": "string"
                    },
                    "area_experiencia": {
                        "type": "string",
                        "nullable": true
                    },
                    "tempo_experiencia": {
                        "type": "string",
                        "nullable": true
                    },
                    "quer_monitor": {
                        "type": "boolean"
                    },
                    "ser_monitor": {
                        "type": "boolean"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "mentoria": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/MentoriaResource"
                            }
                        ],
                        "nullable": true
                    },
                    "monitor": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/MonitorResource"
                            }
                        ],
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "InscricoesPaginated": {
                "properties": {
                    "current_page": {
                        "type": "integer"
                    },
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/InscricaoResource"
                        }
                    },
                    "first_page_url": {
                        "type": "string"
                    },
                    "from": {
                        "type": "integer",
                        "nullable": true
                    },
                    "last_page": {
                        "type": "integer"
                    },
                    "last_page_url": {
                        "type": "string"
                    },
                    "next_page_url": {
                        "type": "string",
                        "nullable": true
                    },
                    "path": {
                        "type": "string"
                    },
                    "per_page": {
                        "type": "integer"
                    },
                    "prev_page_url": {
                        "type": "string",
                        "nullable": true
                    },
                    "to": {
                        "type": "integer",
                        "nullable": true
                    },
                    "total": {
                        "type": "integer"
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "description": "Obtenha o token em `POST /api/auth/login` e envie: `Authorization: Bearer {access_token}`",
                "bearerFormat": "JWT",
                "scheme": "bearer"
            }
        }
    },
    "tags": [
        {
            "name": "Inscrição pública",
            "description": "Formulário do site — sem token"
        },
        {
            "name": "Auth",
            "description": "JWT: login, registro, logout, perfil"
        },
        {
            "name": "Admin — Inscrições",
            "description": "JWT + permissão `view inscricoes`"
        }
    ]
}