/auth/login:
    post:
        operationId: loginUser
        summary: Login to OpenVidu Meet
        description: >
            Authenticates a user and returns an access and refresh token in cookies.
        tags:
            - Internal API - Authentication
        requestBody:
            $ref: '../../components/requestBodies/internal/login-user.yaml'
        responses:
            '200':
                $ref: '../../components/responses/internal/success-user-login.yaml'
            '404':
                $ref: '../../components/responses/internal/error-invalid-credentials.yaml'
            '422':
                $ref: '../../components/responses/validation-error.yaml'
            '500':
                $ref: '../../components/responses/internal-server-error.yaml'
/auth/logout:
    post:
        operationId: logoutUser
        summary: Logout from OpenVidu Meet
        description: >
            Logs out the user and clears the access and refresh tokens from cookies.
        tags:
            - Internal API - Authentication
        responses:
            '200':
                $ref: '../../components/responses/internal/success-user-logout.yaml'
/auth/refresh:
    post:
        operationId: refreshAccessToken
        summary: Refresh access token
        description: >
            Refreshes the access token using the refresh token.
            The new access token is returned in a cookie.
        tags:
            - Internal API - Authentication
        security:
            - refreshTokenCookie: []
        responses:
            '200':
                $ref: '../../components/responses/internal/success-refresh-token.yaml'
            '400':
                $ref: '../../components/responses/internal/error-invalid-refresh-token.yaml'
            '500':
                $ref: '../../components/responses/internal-server-error.yaml'

/auth/api-keys:
    post:
        operationId: createApiKey
        summary: Create a new API key
        description: |
            Creates a new API key, returning it in the response.

            > **Note:** Only one API key can be created in the system.
            > If an API key already exists, it will be replaced with the new one.
        tags:
            - Internal API - Authentication
        security:
            - accessTokenCookie: []
        responses:
            '201':
                $ref: '../../components/responses/internal/success-create-api-key.yaml'
            '500':
                $ref: '../../components/responses/internal-server-error.yaml'
    get:
        operationId: getApiKeys
        summary: Get API keys
        description: |
            Retrieves the existing API keys.

            > **Note:** Only one API key can exist in the system.
            > If no API key exists, an empty array will be returned.
        tags:
            - Internal API - Authentication
        security:
            - accessTokenCookie: []
        responses:
            '200':
                $ref: '../../components/responses/internal/success-get-api-keys.yaml'
            '500':
                $ref: '../../components/responses/internal-server-error.yaml'
    delete:
        operationId: deleteApiKeys
        summary: Delete API keys
        description: >
            Deletes the existing API keys.
        tags:
            - Internal API - Authentication
        security:
            - accessTokenCookie: []
        responses:
            '200':
                $ref: '../../components/responses/internal/success-delete-api-key.yaml'
            '500':
                $ref: '../../components/responses/internal-server-error.yaml'
