openapi: 3.0.0
info:
  version: "1.0.0"
  title: Invited User API
  description: API for managing invited users
  contact:
    name: Team ADI
  license:
    name: 'Industrial Edge © 2025, Siemens AG. All rights reserved.'
servers:
  - url: 'https://localhost/device/edge/b.service/api/v1'
tags:
  - name: users
paths:
  /users/invitedusers:
    get:
      tags:
        - users
      summary: Get invited users
      description: This method lists all invited users on edge device
      operationId: getInvitedUsers
      parameters:
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
          description: The authentication token
      responses:
        '200':
          description: Returns a List of user in form of data.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ApplicationUserVO'
              examples:
                invitedUsers:
                  $ref: '#/components/examples/InvitedUsers'
        '400':
          description: |-
            Bad Request
            - Invalid command
            - Missing Token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Missing Token:
                  $ref: '#/components/examples/MissingToken'
        '401':
          description: |-
            Unauthorized:
            - Invalid Auth Token
            - Expired Auth Token
            - User of the Auth Token was not Found
            - Unable to Verify Auth Token
            - Not permitted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Expired Token:
                  $ref: '#/components/examples/ExpiredToken'
                Invalid Token:
                  $ref: '#/components/examples/InvalidToken'
                Token User Not Found:
                  $ref: '#/components/examples/TokenUserNotFound'
                Unable To verify Token:
                  $ref: '#/components/examples/UnableToVerifyToken'
                Not Permitted:
                  $ref: '#/components/examples/NotPermitted'
        '500':
          description: |-
            Internal Server Error
            - Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                InternalServerError:
                  $ref: '#/components/examples/InternalServerError'
                  
components:
  parameters:
    Authorization:
      name: Authorization
      in: header
      required: true
      schema:
        type: string
      description: Authorization token
    X-Correlation-ID:
      name: X-Correlation-ID
      in: header
      required: false
      schema:
        type: string
      description: Correlates logs
  schemas:
    ApplicationUserVO:
      type: object
      properties:
        appUserId: 
          type: string
        role: 
          type: string
        userId: 
          type: string
        firstName: 
          type: string
        lastName: 
          type: string
        emailId: 
          type: string
        shareUrl:  
          type: string
        userStatus: 
          type: string
        createdDate:
          type: integer
        modifiedDate: 
          type: integer
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorResponseVO'
    ErrorResponseVO:
      type: object
      properties:
        code:
          type: string
        data:
          type: object
        field:
          type: string
        innerError:
          type: string
        logref:
          type: string
        message:
          type: string

  examples:
    ExpiredToken:
      value:
        errors:
          - code: edge.auth.expiredToken
            message: Token expired.
            logref: 5432e1d8-5916-4619-88ec-a507f83331bd
    InvalidToken:
      value:
        errors:
          - code: edge.auth.invalidToken
            message: Token is invalid.
            logref: 5432e1d8-5916-4619-88ec-a507f83331bd
    TokenUserNotFound:
      value:
        errors:
          - code: auth.application.userNotFound
            message: User not found.
            logref: 5432e1d8-5916-4619-88ec-a507f83331bd
    UnableToVerifyToken:
      value:
        errors:
          - code: auth.token.unableToVerifyToken
            message: Unable to verify token.
            logref: 5432e1d8-5916-4619-88ec-a507f83331bd
    MissingToken:
      value:
        errors:
          - code: edge.auth.missingToken
            message: Token is required.
            logref: 3505f6bd-30cd-4deb-981d-02e89f82aa8f
    NotPermitted:
      value:
        errors:
          - code: edge.notPermitted
            message: Access denied.
            logref: 5432e1d8-5916-4619-88ec-a507f83331bd
    InternalServerError:
      value:
        errors:
          - code: edge.authapplicationusers.unableToListUser
            logref: 5432e1d8-5916-4619-88ec-a507f83331bd
            message: Internal server error.
    InvitedUsers:
      value:
        data:
          - appUserId: "de4e24a0-0a9e-4149-a122-dd2836b9b35a"
            role: "User"
            userId: "578d7e60-57fa-4a1a-b899-5a99ec394d81"
            firstName: "Firstname1"
            lastName: "Lastname1"
            emailId: "user1@company.com"
            shareUrl: ""
            userStatus: "approved"
            createdDate: 1738073080000000000
            modifiedDate: 1738073080000000000
          - appUserId: "3a5f7902-6adf-4daa-90ed-35f837564089"
            role: "Admin"
            userId: "4301cbff-b5fb-4302-b99e-67722c849410"
            firstName: "Firstname2"
            lastName: "Lastname2"
            emailId: "user2@company.com"
            shareUrl: ""
            userStatus: "approved"
            createdDate: 1738073301000000000
            modifiedDate: 1738073301000000000

  responses:
    TokenError:
      description: |-
        Unauthorized:
        - Missing the auth token
        - Invalid auth token
        - Expired auth token
        - User of the auth token was not found
        - Unable to verify auth token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            ExampleExpiredTokenError:
              $ref: '#/components/examples/ExpiredToken'
            ExampleInvalidTokenError:
              $ref: '#/components/examples/InvalidToken'
            ExampleMissingTokenError:
              $ref: '#/components/examples/MissingToken'
            ExampleTokenUserNotFoundError:
              $ref: '#/components/examples/TokenUserNotFound'
            ExampleUnableToVerifyTokenError:
              $ref: '#/components/examples/UnableToVerifyToken'