import { Attr } from 'ts-framework' import * as constants from '../constants' import { OrganizationResponseDTO } from './organization' import { OrganizationTeamMemberJwtDTO } from './organization-team-member' import { ProviderTeamMemberJwtDTO } from './provider-team-member' import { UserPhoneNumberDTO } from './user-phones' export interface AuthJwtPayloadDTO { id: string email?: string phone?: UserPhoneNumberDTO firstName: string lastName: string streamToken?: string rolesInProviders: ProviderTeamMemberJwtDTO[] rolesInOrganizations: OrganizationTeamMemberJwtDTO[] organizations: OrganizationResponseDTO[] rolesInApp: string[] } export interface AuthRefreshJwtPayloadDTO { exp: number iat: number id: string jti: string } export class AuthRequestDTO { @Attr({ type: Object }) authJwtPayload: AuthJwtPayloadDTO } export interface AuthTokenDTO { accessToken: string refreshToken: string } export interface MobileTokenDTO { token: string } export class LoginByCredentialsDTO { @Attr({ type: String }) emailOrUsername: string @Attr({ type: String }) password: string } export class LoginByMobileCredentialsDTO { @Attr({ type: String }) emailOrUsername: string @Attr({ type: String }) password: string @Attr({ type: String, resolver: { type: 'enum', params: constants.ApplicationTypes } }) appType: string } export class LoginByMobileTokenDTO { @Attr({ type: Number }) token: string @Attr({ type: String }) phoneNumber: string @Attr({ type: String }) countryCode: string @Attr({ type: String, resolver: { type: 'enum', params: constants.ApplicationTypes } }) appType: string } export class RefreshTokenDTO { @Attr({ type: String }) refreshToken: string } export class RefreshMobileTokenDTO { @Attr({ type: String }) refreshToken: string @Attr({ type: String, resolver: { type: 'enum', params: constants.ApplicationTypes } }) appType: string } export interface UserCreationTokenDTO { creationToken: string } export class LoginByLoginTokenAndPinCodeDTO { @Attr({ type: String }) loginToken: string @Attr({ type: String }) pinCode: string @Attr({ type: String, resolver: { type: 'enum', params: constants.ApplicationTypes } }) appType: string } export class RecoverPasswordDTO { @Attr({ type: String }) email: string } export interface PinCodeAndUserIdDTO { userId: string pinCode: string } export interface LoginTokenResponseDTO { loginToken: string phone: UserPhoneNumberDTO } export class LogoutRequestDTO { @Attr({ type: String, resolver: { type: 'enum', params: constants.ApplicationTypes } }) appType: string }