/**
 * User related type definitions
 */

import type { UUID, Timestamps } from './common.types.js';

export enum UserType {
  ANONYMOUS = 'ANONYMOUS',
  REGISTERED = 'REGISTERED',
}

export interface User extends Timestamps {
  id: UUID;
  type: UserType;
  fingerprint?: string;
  phone?: string;
  nickname?: string;
  avatar?: string;
  lastActiveAt: Date;
}

export interface AnonymousSession {
  sessionId: UUID;
  fingerprint: string;
  userId: UUID;
  expiresAt: Date;
}

export interface CreateAnonymousUserDto {
  fingerprint: string;
}

export interface VerifyPhoneDto {
  phone: string;
  code: string;
}

export interface SendVerificationCodeDto {
  phone: string;
}

export interface UserProfile {
  id: UUID;
  type: UserType;
  phone?: string;
  nickname?: string;
  avatar?: string;
  conversationCount: number;
  lastActiveAt: Date;
  createdAt: Date;
}

// Admin User Types
export enum AdminRole {
  SUPER_ADMIN = 'SUPER_ADMIN',
  ADMIN = 'ADMIN',
  OPERATOR = 'OPERATOR',
  VIEWER = 'VIEWER',
}

export interface AdminUser extends Timestamps {
  id: UUID;
  username: string;
  email?: string;
  role: AdminRole;
  isActive: boolean;
  lastLoginAt?: Date;
}

export interface AdminLoginDto {
  username: string;
  password: string;
}

export interface AdminLoginResponse {
  accessToken: string;
  refreshToken: string;
  admin: Omit<AdminUser, 'passwordHash'>;
}
