import type { RoomMember } from './user.models';
import type {
  ChannelPermissionOverride,
  RoomRole,
  RoomRoleAssignment
} from './access-control.models';

export type ChannelType = 'text' | 'voice';

export interface Channel {
  id: string;
  name: string;
  type: ChannelType;
  position: number;
}

export interface Room {
  id: string;
  name: string;
  description?: string;
  topic?: string;
  hostId: string;
  password?: string;
  hasPassword?: boolean;
  isPrivate: boolean;
  createdAt: number;
  userCount: number;
  maxUsers?: number;
  icon?: string;
  iconUpdatedAt?: number;
  slowModeInterval?: number;
  permissions?: RoomPermissions;
  channels?: Channel[];
  members?: RoomMember[];
  roles?: RoomRole[];
  roleAssignments?: RoomRoleAssignment[];
  channelPermissions?: ChannelPermissionOverride[];
  sourceId?: string;
  sourceName?: string;
  sourceUrl?: string;
}

export interface RoomSettings {
  name: string;
  description?: string;
  topic?: string;
  isPrivate: boolean;
  password?: string;
  hasPassword?: boolean;
  maxUsers?: number;
  rules?: string[];
}

export interface RoomPermissions {
  adminsManageRooms?: boolean;
  moderatorsManageRooms?: boolean;
  adminsManageIcon?: boolean;
  moderatorsManageIcon?: boolean;
  allowVoice?: boolean;
  allowScreenShare?: boolean;
  allowFileUploads?: boolean;
  slowModeInterval?: number;
}
