/**
 * Group Chat DTOs
 */

import type { UserDTO } from './user';

export type JoinType = 0 | 1 | 2;
export type GroupRole = 'owner' | 'admin' | 'member';

export interface GroupResponse {
  id: string;
  name: string;
  avatar: string;
  description: string;
  owner_id: string;
  member_count: number;
  max_members: number;
  join_type: JoinType;
  mute_all: boolean;
  created_at: string;
}

export interface GroupMemberResponse {
  id: number;
  group_id: string;
  user_id: string;
  role: GroupRole;
  nickname: string;
  muted: boolean;
  join_time: string;
  user?: UserDTO;
}

export interface GroupAnnouncementResponse {
  id: number;
  group_id: string;
  content: string;
  author_id: string;
  is_pinned: boolean;
  created_at: string;
}

export interface CreateGroupRequest {
  name: string;
  description?: string;
  member_ids?: string[];
}

export interface UpdateGroupRequest {
  name?: string;
  description?: string;
  avatar?: string;
}

export interface InviteMembersRequest {
  member_ids: string[];
}

export interface HandleGroupRequestAction {
  flag: string;
  approve: boolean;
  reason?: string;
}

export interface TransferOwnerRequest {
  new_owner_id: string;
}

export interface SetRoleRequest {
  role: 'admin' | 'member';
}

export interface SetNicknameRequest {
  nickname: string;
}

export interface MuteMemberRequest {
  muted: boolean;
}

export interface SetMuteAllRequest {
  mute_all: boolean;
}

export interface MyMemberInfoResponse {
  member: GroupMemberResponse;
  mute_all: boolean;
  is_muted: boolean;
  can_speak: boolean;
}

export interface SetJoinTypeRequest {
  join_type: JoinType;
}

export interface SetGroupAvatarRequest {
  avatar: string;
}

export interface CreateAnnouncementRequest {
  content: string;
}

export interface GroupListResponse {
  list: GroupResponse[];
  total: number;
  page: number;
  page_size: number;
  total_pages: number;
}

export interface GroupMemberListResponse {
  list: GroupMemberResponse[];
  total: number;
  page: number;
  page_size: number;
  total_pages: number;
}

export interface GroupAnnouncementListResponse {
  list: GroupAnnouncementResponse[];
  total: number;
  page: number;
  page_size: number;
  total_pages: number;
}