
components:

    schemas:

        CurrentLoginUser:
            type: object
            properties:
                subject:
                    $ref: '../rbac/rbac-subject-schemas.yaml#/components/schemas/RbacSubject'
                person:
                    $ref: '../hs-office/hs-office-person-schemas.yaml#/components/schemas/HsOfficePerson'
                globalAdmin:
                    type: boolean

        Credentials:
            type: object
            properties:
                uuid:
                    type: string
                    format: uuid
                person:
                    $ref: '../hs-office/hs-office-person-schemas.yaml#/components/schemas/HsOfficePerson'
                nickname:
                    type: string
                    pattern: '^[a-z][a-z0-9]{1,8}-[a-z0-9]{1,10}$' # TODO.spec: pattern for login nickname
                totpSecrets:
                    type: array
                    items:
                        type: string
                phonePassword:
                    type: string
                emailAddress:
                    type: string
                smsNumber:
                    type: string
                active:
                    type: boolean
                globalUid:
                    type: number
                globalGid:
                    type: number
                onboardingToken:
                    type: string
                contexts:
                    type: array
                    items:
                        $ref: 'context-schemas.yaml#/components/schemas/Context'
                lastUsed:
                    type: string
                    format: date-time
            required:
                - uuid
                - active
                - contexts
            additionalProperties: false

        CredentialsPatch:
            type: object
            properties:
                totpSecrets:
                    type: array
                    items:
                        type: string
                phonePassword:
                    type: string
                    nullable: true
                emailAddress:
                    type: string
                    nullable: true
                smsNumber:
                    type: string
                    nullable: true
                active:
                    type: boolean
                contexts:
                    type: array
                    items:
                        $ref: 'context-schemas.yaml#/components/schemas/Context'
            additionalProperties: false

        CredentialsInsert:
            type: object
            properties:
                person.uuid:
                    type: string
                    format: uuid
                nickname:
                    type: string
                    pattern: '^[a-z][a-z0-9]{1,8}-[a-z0-9]{1,10}$' # TODO.spec: pattern for login nickname
                totpSecrets:
                    type: array
                    items:
                        type: string
                phonePassword:
                    type: string
                emailAddress:
                    type: string
                smsNumber:
                    type: string
                active:
                    type: boolean
                globalUid:
                    type: number
                globalGid:
                    type: number
                onboardingToken:
                    type: string
                contexts:
                    type: array
                    items:
                        $ref: 'context-schemas.yaml#/components/schemas/Context'
            required:
                - person.uuid
                - nickname
                - active
            additionalProperties: false

