---
components:
  responses: {}
  schemas:
    Response400:
      description: Bad Request
      example:
        errors:
          detail: Bad Request
      properties:
        errors:
          type: object
      title: Response400
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.Response400
    Response401AuthenticationRequired:
      description: 'Error: Unauthorized (Authentication required)'
      example:
        message: This endpoint is only accessible to authenticated users.
      properties:
        message:
          type: string
      title: Response401AuthenticationRequired
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.Response401AuthenticationRequired
    Response403:
      description: 'Error: Forbidden'
      example:
        message: Forbidden
      properties:
        message:
          type: string
      title: Response403
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.Response403
    TodoCreateResponse201:
      description: Created
      example:
        data:
          content: Todo item content
          id: 123
          is_completed: false
      properties:
        data:
          items:
            $ref: '#/components/schemas/TodoSchema'
          type: object
      title: TodoCreateResponse201
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.TodoCreateResponse201
    TodoDeleteResponse204:
      description: No Content
      title: TodoDeleteResponse204
      x-struct: Elixir.TodoListWeb.Schemas.TodoDeleteResponse204
    TodoListResponse200:
      description: OK
      example:
        data:
          - content: First todo item
            id: 123
            is_completed: true
          - content: Second todo item
            id: 456
            is_completed: false
      properties:
        data:
          items:
            $ref: '#/components/schemas/TodoSchema'
          type: list
      title: TodoListResponse200
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.TodoListResponse200
    TodoRequest:
      description: The parameters required when creating or updating a todo item.
      example:
        todo:
          content: Todo item content
          is_completed: false
      properties:
        todo:
          items:
            $ref: '#/components/schemas/TodoSchema'
          type: object
      required:
        - content
      title: TodoRequest
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.TodoRequest
    TodoSchema:
      properties:
        content:
          type: string
        id:
          type: integer
        is_completed:
          type: boolean
      title: TodoSchema
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.TodoSchema
    TodoShowResponse200:
      description: OK
      example:
        data:
          content: Todo item content
          id: 123
          is_completed: false
      properties:
        data:
          description: Todo data
          type: object
      title: TodoShowResponse200
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.TodoShowResponse200
    TodoUpdateResponse200:
      description: OK
      example:
        data:
          content: Todo item content
          id: 123
          is_completed: false
      properties:
        data:
          items:
            $ref: '#/components/schemas/TodoSchema'
          type: object
      title: TodoUpdateResponse200
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.TodoUpdateResponse200
    UserAuthRequest:
      description: User registration/login request
      example:
        user:
          email: user@example.com
          password: your_password
      properties:
        user:
          items:
            $ref: '#/components/schemas/UserAuthSchema'
          type: object
      required:
        - user
      title: UserAuthRequest
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.UserAuthRequest
    UserAuthSchema:
      description: The parameters required when registering or logging in a user.
      properties:
        user:
          items:
            $ref: '#/components/schemas/UserAuthSchemaUser'
          type: object
      required:
        - user
      title: UserAuthSchema
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.UserAuthSchema
    UserAuthSchemaUser:
      description: A child schema for user authentication. Describes the user used by UserAuthSchema.
      properties:
        email:
          description: Email address
          format: email
          type: string
        password:
          description: Password
          format: password
          minLength: 8
          type: string
      required:
        - email
        - password
      title: UserAuthSchemaUser
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.UserAuthSchemaUser
    UserCheckTokenResponse200:
      description: OK
      example: true
      title: UserCheckTokenResponse200
      type: boolean
      x-struct: Elixir.TodoListWeb.Schemas.UserCheckTokenResponse200
    UserLoginResponse200:
      description: OK
      example:
        user:
          id: 123
          token: 1234567890abcdefghijklmnopqABCDEFGHIJKLMNOP=
      properties:
        user:
          description: User ID and token
          type: object
      title: UserLoginResponse200
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.UserLoginResponse200
    UserLoginResponse401:
      description: 'Unauthorized: Invalid credentials'
      example:
        message: Invalid email or password
      properties:
        message:
          type: string
      title: UserLoginResponse401
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.UserLoginResponse401
    UserLogoutResponse200:
      description: OK
      example:
        message: Logged out successfully
      properties:
        message:
          type: string
      title: UserLogoutResponse200
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.UserLogoutResponse200
    UserRegisterResponse201:
      description: Created
      example:
        user:
          id: 123
          token: 1234567890abcdefghijklmnopqABCDEFGHIJKLMNOP=
      properties:
        user:
          description: User ID and token
          type: object
      title: UserRegisterResponse201
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.UserRegisterResponse201
    UserRegisterResponse400:
      description: Bad Request
      example:
        errors:
          email:
            - This is not a valid email address.
            - has already been taken
          password:
            - should be at least 8 character(s)
      properties:
        errors:
          description: Errors
          type: object
      title: UserRegisterResponse400
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.UserRegisterResponse400
    UserShowResponse200:
      description: OK
      example:
        data:
          email: user@example.com
          id: 123
      properties:
        data:
          description: User data
          type: object
      title: UserShowResponse200
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.UserShowResponse200
    UserUpdateRequest:
      description: User update request
      example:
        data:
          current_password: password
          password: new_password
      properties:
        current_password:
          description: Current password
          format: password
          type: string
        password:
          description: New password
          format: password
          minLength: 8
          type: string
      title: UserUpdateRequest
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.UserUpdateRequest
    UserUpdateResponse200:
      description: OK
      example:
        message: Password changed successfully. All sessions for this user have been logged out.
      properties:
        message:
          type: string
      title: UserUpdateResponse200
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.UserUpdateResponse200
    UserUpdateResponse400:
      description: Bad Request
      example:
        errors:
          password:
            - should be at least 8 character(s)
            - This is not your current password.
      properties:
        errors:
          description: Errors
          type: object
      title: UserUpdateResponse400
      type: object
      x-struct: Elixir.TodoListWeb.Schemas.UserUpdateResponse400
  securitySchemes:
    bearerAuth:
      description: Bearer authentication with required prefix 'Bearer'
      in: header
      name: authorization
      scheme: bearer
      type: http
info:
  title: Phoenix Todo List
  version: 0.1.0
openapi: 3.0.0
paths:
  /api/todos:
    get:
      callbacks: {}
      operationId: TodoListWeb.Api.TodoController.index
      parameters: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TodoListResponse200'
          description: OK
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response401AuthenticationRequired'
          description: 'Error: Unauthorized [Authentication required]'
      security:
        - bearerAuth: []
      summary: List todo items
      tags:
        - todos
    post:
      callbacks: {}
      operationId: TodoListWeb.Api.TodoController.create
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TodoRequest'
        description: Todo creation request
        required: false
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TodoCreateResponse201'
          description: Created
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response400'
          description: 'Error: Bad Request'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response401AuthenticationRequired'
          description: 'Error: Unauthorized [Authentication required]'
      security:
        - bearerAuth: []
      summary: Create new todo item
      tags:
        - todos
  /api/todos/{id}:
    delete:
      callbacks: {}
      operationId: TodoListWeb.Api.TodoController.delete
      parameters:
        - description: Todo ID
          example: 123
          in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        '204':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TodoDeleteResponse204'
          description: No Content
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response401AuthenticationRequired'
          description: 'Error: Unauthorized [Authentication required]'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response403'
          description: 'Error: Forbidden'
      security:
        - bearerAuth: []
      summary: Delete todo item
      tags:
        - todos
    get:
      callbacks: {}
      operationId: TodoListWeb.Api.TodoController.show
      parameters:
        - description: Todo ID
          example: 123
          in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TodoShowResponse200'
          description: OK
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response401AuthenticationRequired'
          description: 'Error: Unauthorized [Authentication required]'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response403'
          description: 'Error: Forbidden'
      security:
        - bearerAuth: []
      summary: Show todo item detail
      tags:
        - todos
    patch:
      callbacks: {}
      operationId: TodoListWeb.Api.TodoController.update
      parameters:
        - description: Todo ID
          example: 123
          in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TodoRequest'
        description: Todo update request
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TodoUpdateResponse200'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response400'
          description: 'Error: Bad Request'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response401AuthenticationRequired'
          description: 'Error: Unauthorized [Authentication required]'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response403'
          description: 'Error: Forbidden'
      security:
        - bearerAuth: []
      summary: Update todo item
      tags:
        - todos
    put:
      callbacks: {}
      operationId: TodoListWeb.Api.TodoController.update (2)
      parameters:
        - description: Todo ID
          example: 123
          in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TodoRequest'
        description: Todo update request
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TodoUpdateResponse200'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response400'
          description: 'Error: Bad Request'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response401AuthenticationRequired'
          description: 'Error: Unauthorized [Authentication required]'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response403'
          description: 'Error: Forbidden'
      security:
        - bearerAuth: []
      summary: Update todo item
      tags:
        - todos
  /api/users:
    post:
      callbacks: {}
      operationId: TodoListWeb.Api.AccountsController.create
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserAuthRequest'
        description: User registration/login request
        required: false
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserRegisterResponse201'
          description: Created
          headers:
            location:
              schema:
                description: The location of the user's profile data.
                example: /users/:id/detail
                type: string
              style: simple
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserRegisterResponse400'
          description: Bad Request
      summary: Register new user
      tags:
        - users
  /api/users/login:
    post:
      callbacks: {}
      operationId: TodoListWeb.Api.AccountsController.login
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserAuthRequest'
        description: User registration/login request
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserLoginResponse200'
          description: OK
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserLoginResponse401'
          description: 'Unauthorized: Invalid credentials'
      summary: Login user
      tags:
        - users
  /api/users/{id}:
    delete:
      callbacks: {}
      operationId: TodoListWeb.Api.AccountsController.delete
      parameters:
        - description: User ID
          example: 123
          in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserLogoutResponse200'
          description: OK
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response401AuthenticationRequired'
          description: 'Error: Unauthorized [Authentication required]'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response403'
          description: 'Error: Forbidden'
      security:
        - bearerAuth: []
      summary: User logout
      tags:
        - users
    get:
      callbacks: {}
      operationId: TodoListWeb.Api.AccountsController.show
      parameters:
        - description: User ID
          example: 123
          in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserShowResponse200'
          description: OK
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response401AuthenticationRequired'
          description: 'Error: Unauthorized [Authentication required]'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response403'
          description: 'Error: Forbidden'
      security:
        - bearerAuth: []
      summary: Show user detail
      tags:
        - users
    patch:
      callbacks: {}
      operationId: TodoListWeb.Api.AccountsController.update
      parameters:
        - description: User ID
          example: 123
          in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserUpdateRequest'
        description: Change user password request
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserUpdateResponse200'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserUpdateResponse400'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response401AuthenticationRequired'
          description: 'Error: Unauthorized [Authentication required]'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response403'
          description: 'Error: Forbidden'
      security:
        - bearerAuth: []
      summary: Change user password
      tags:
        - users
    put:
      callbacks: {}
      operationId: TodoListWeb.Api.AccountsController.update (2)
      parameters:
        - description: User ID
          example: 123
          in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserUpdateRequest'
        description: Change user password request
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserUpdateResponse200'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserUpdateResponse400'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response401AuthenticationRequired'
          description: 'Error: Unauthorized [Authentication required]'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response403'
          description: 'Error: Forbidden'
      security:
        - bearerAuth: []
      summary: Change user password
      tags:
        - users
  /api/users/{id}/check-token:
    get:
      callbacks: {}
      operationId: TodoListWeb.Api.AccountsController.check_token
      parameters:
        - description: User ID
          example: 123
          in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserCheckTokenResponse200'
          description: OK
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response401AuthenticationRequired'
          description: 'Error: Unauthorized [Authentication required]'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response403'
          description: 'Error: Forbidden'
      security:
        - bearerAuth: []
      summary: Check if user token is valid
      tags:
        - users
security: []
servers:
  - url: https://phoenix-todo-list.nicholasmoen.com/
    variables: {}
tags: []
