import { AssignmentDto, RoleSettingsDto } from '../../index.js';
import { DataTreeGroup } from '../group/index.js';

export interface User {
  id: string;
  email: string;
  currentOrganizationId: string;
  organizationIds: string[];
  isAnonymous: boolean;
}

export enum ApplicationUserStatus {
  EDITOR_PENDING_JOIN = 0,
  EDITOR_JOINED = 1
}

export interface ApplicationUserDto {
  name: string;
  email: string;
  id: string;
  status: ApplicationUserStatus;
}

export enum OrganizationUserStatus {
  PENDING = 0,
  ACTIVE = 1,
  INACTIVE = 2
}

export interface OrganizationUserDto {
  name: string;
  email: string;
  id: string;
  status: OrganizationUserStatus;
  type?: UserType;
  lastJwtIssuedAt?: Date;
  assignments?: AssignmentDto[];
}

export type Domain = {
  id: string;
  name: string;
  allowed: boolean;
};

export type GetOrganizationGeneralResponseBody = {
  name: string;
  allowedDomains: Domain[];
  roleSettings: RoleSettingsDto;
};

export type PatchOrganizationGeneralResponseBody = {
  name?: string;
  allowedDomains?: string[];
  roleSettings?: RoleSettingsDto;
};

export type DataTreeUser = {
  name: string;
  email: string;
  id: string;
  groups: DataTreeGroup[];
  username: string;
  metadata: Record<string, unknown>;
};

export enum AccessMode {
  VISITOR = 'visitor',
  AUTH_USER = 'auth_user',
  EXTERNAL_USER = 'external_user'
}

export enum UserSource {
  SUPERBLOCKS = 'SUPERBLOCKS',
  SCIM = 'SCIM'
}

export enum UserType {
  SUPERBLOCKS = 'SUPERBLOCKS',
  EXTERNAL = 'EXTERNAL'
}

export type UserAuthSource = 'Superblocks' | 'Auth0' | 'Anonymous';

export enum RequestSource {
  SUPERBLOCKS = 'superblocks',
  EMBED = 'embed'
}

export * from './analytics.js';
export * from './emailVerification.js';
export * from './survey.js';
