openapi: 3.0.0
info:
  title: Documentação da api pública - Ticketeria
  description: API Public by Ticketeria
  termsOfService: ''
  contact:
    email: ti@ticketeria.tk
  version: 1.0.0
servers:
  - url: 'https://api.ticketeria.tk/api'
    description: Dev
  - url: 'http://localhost:{port}/api'
    description: Localhost Dev
    variables:
      port:
        enum:
          - '8080'
        default: '8080'
tags:
  - name: Auth
paths:
  /auth/login:
    post:
      tags:
        - Auth
      summary: Obtenha uma autorização de token de usuário.
      description: >-
        Obtém uma autorização de token. Digite o nome de usuário e a senha na
        guia 'Autorizar'. Em seguida, execute o endpoint /auth/login para obter
        um token de usuário.
      operationId: login
      consumes:
        - application/json
      security:
        - basicAuth: []
      responses:
        '201':
          description: >-
            Obtém uma autorização de token no parâmetro de resposta
            'access_token'.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseBasicAuth'
        '401':
          description: >-
            Dados do usuário inseridos incorretamente ou não inseridos. Entre
            com usuário e senha na aba 'Autorizar' e tente novamente!
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseUnauthorized'
  /auth/resetpassword:
    post:
      tags:
        - Auth
      summary: Reset Password
      description: Envia um link para o usuário alterar a senha.
      operationId: resetpassword
      consumes:
        - application/json
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  description: e-mail do usuário
                  type: string
                  example: useradmin@localhost
              required:
                - email
      responses:
        '200':
          description: Resposta da solicitação. Cliente receberá email para alterar a senha
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseResetPassword'
        '401':
          description: Dados do usuário inseridos incorretamente ou não inseridos.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseResetPasswordFail'
  '/auth/verify/{hashlink}':
    get:
      tags:
        - Auth
      summary: verify hash
      description: Valida link enviado para o usuário alterar a senha.
      operationId: verify
      consumes:
        - application/json
      parameters:
        - in: path
          name: hashlink
          type: string
          required: true
          description: Hash link enviado para o usuário
          example: 53376a1530fbb53e1cc611b6e7b338d3
      responses:
        '200':
          description: Resposta da solicitação. Cliente receberá email para alterar a senha
          content:
            application/json:
              schema:
                properties:
                  status:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: null
                  user:
                    properties:
                      email:
                        type: string
                        example: useradmin@localhost
                      name:
                        type: string
                        example: User Administrator
                      dtvalidhash:
                        type: datetime
                        example: '2022-11-07 22:26:22'
                    type: object
                type: object
        '401':
          description: Dados do usuário inseridos incorretamente ou não inseridos.
          content:
            application/json:
              schema:
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Usuário não encontrado ou não ativo
                type: object
  /auth/recovery:
    post:
      tags:
        - Auth
      summary: Re-set Password
      description: Altera a senha.
      operationId: recovery
      consumes:
        - application/json
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  description: e-mail do usuário
                  type: string
                  example: useradmin@localhost
                hash:
                  description: Hask de alteração de senha
                  type: string
                  example: 331b0fdb7a89fddf08966712edcb73f2
                password:
                  description: Senha nova
                  type: string
                  example: '123456'
              required:
                - email
                - hash
                - password
      responses:
        '200':
          description: Resposta da solicitação. Cliente receberá email para alterar a senha
          content:
            application/json:
              schema:
                properties:
                  status:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: null
                  user:
                    properties:
                      id:
                        type: integer
                        example: 121
                      email:
                        type: string
                        example: useradmin@localhost
                      name:
                        type: string
                        example: Nome do usuário
                    type: object
                type: object
        '401':
          description: Dados do usuário inseridos incorretamente ou não inseridos.
          content:
            application/json:
              schema:
                description: Part of the requisition model
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Link inválido ou expirado
                type: object
components:
  schemas:
    ResponseBasicAuth:
      description: Part of the requisition model
      allOf:
        - description: Part of the requisition model
          properties:
            token_type:
              type: string
              example: Bearer
            expires_in:
              type: integer
              example: 1667701448
            access_token:
              type: string
            user:
              properties:
                id:
                  type: integer
                  example: 121
                name:
                  type: string
                  example: User Administrator
                email:
                  type: string
                  example: useradmin@localhost
              type: object
          type: object
    ResponseResetPassword:
      description: Part of the requisition model
      properties:
        status:
          type: boolean
          example: true
        message:
          type: string
          example: null
        user:
          properties:
            email:
              type: string
              example: useradmin@localhost
          type: object
      type: object
    ResponseResetPasswordFail:
      description: Part of the requisition model
      properties:
        status:
          type: boolean
          example: false
        message:
          type: string
          example: Usuário não encontrado ou não ativo
      type: object
    ResponseUnauthorized:
      description: Request model to update property data.
      allOf:
        - $ref: '#/components/schemas/successFalse'
        - $ref: '#/components/schemas/Unauthorized'
        - $ref: '#/components/schemas/messageUnauth'
    ResponseFobidden:
      description: Part of the requisition model
      allOf:
        - $ref: '#/components/schemas/successFalse'
    ResponseNotAllowed:
      description: Part of the requisition model
      allOf:
        - $ref: '#/components/schemas/successFalse'
    ResponseBadRequest:
      description: Part of the requisition model
      allOf:
        - $ref: '#/components/schemas/successFalse'
    success:
      description: Part of the requisition model
      properties:
        status:
          type: boolean
          example: true
      type: object
    successFalse:
      description: Part of the requisition model
      properties:
        status:
          type: integer
          example: 401
      type: object
    messageOk:
      description: Part of the requisition model
      properties:
        message:
          type: string
          example: ok
        uuid:
          type: string
          example: 144dae74-ae92-4a12-a2fd-194cb6c1eea8
        time:
          type: number
          format: double
          example: 4.099783182144165
      type: object
    messageUnauth:
      description: Part of the requisition model
      properties:
        messages:
          properties:
            error:
              type: string
              example: Usuário/senha inválidos
          type: object
      type: object
    Unauthorized:
      description: Part of the requisition model
      properties:
        error:
          type: integer
          example: 401
      type: object
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
