export type TAppType = 'global' | 'partner' | 'custom_oidc'; export type TAppApprovalStatus = 'draft' | 'pending_review' | 'approved' | 'rejected' | 'suspended'; export type TOAuthClientType = 'public' | 'confidential'; export interface IOidcSettings { accessTokenLifetime: number; idTokenLifetime: number; refreshTokenLifetime: number; } export interface IOAuthCredentials { clientId: string; clientType: TOAuthClientType; redirectUris: string[]; postLogoutRedirectUris: string[]; allowedScopes: string[]; grantTypes: ('authorization_code' | 'refresh_token')[]; } export interface IAppBaseData { name: string; description: string; logoUrl: string; appUrl: string; } export interface IGlobalApp { id: string; type: 'global'; data: IAppBaseData & { oauthCredentials: IOAuthCredentials; oidcSettings: IOidcSettings; isActive: boolean; category: string; createdAt: number; createdByUserId: string; }; } export interface IPartnerApp { id: string; type: 'partner'; data: IAppBaseData & { ownerOrganizationId: string; oauthCredentials: IOAuthCredentials; oidcSettings: IOidcSettings; appStoreMetadata: { shortDescription: string; longDescription: string; screenshots: string[]; category: string; tags: string[]; pricing: { model: 'free' | 'paid' | 'freemium'; }; }; approvalStatus: TAppApprovalStatus; isPublished: boolean; installCount: number; }; } export interface ICustomOidcApp { id: string; type: 'custom_oidc'; data: IAppBaseData & { ownerOrganizationId: string; oauthCredentials: IOAuthCredentials; oidcSettings: IOidcSettings; isActive: boolean; }; } export type IApp = IGlobalApp | IPartnerApp | ICustomOidcApp; /** * Browser destination used by the refresh/transfer-token exchange flow. */ export interface ITransferTarget { appUrl: string; } /** * Storage interface for SmartData documents * Uses the discriminated union approach with a 'type' field */ export interface IAppDocument { id: string; type: TAppType; data: IGlobalApp['data'] | IPartnerApp['data'] | ICustomOidcApp['data']; }