declare namespace MasterModel {
  interface GroupBodyRequest {
    id?: string;
    name: string;
    parent_id?: string;
    description?: string;
    metadata?: GroupMetadata;
  }
  interface AddGroupBodyResponse extends Partial<GroupBodyRequest> {
    id: string;
  }

  interface GroupMetadata {
    code?: string;
    short_name?: string;
    has_thing?: boolean;
    [key: string]: unknown;
  }

  interface GroupResponse {
    total?: number;
    level?: number;
    name?: string;
    groups?: GroupNode[];
  }
  interface GroupNode {
    id: string;
    name: string;
    owner_id: string;
    description: string;
    metadata: GroupMetadata;
    level: number;
    path: string;
    parent_id?: string;
    created_at?: string;
    updated_at?: string;
    children?: GroupNode[]; // Đệ quy: mỗi node có thể có children là mảng GroupNode
    [key: string]: any; // Nếu có thêm trường động
  }

  interface GroupQueryParams {
    level?: number;
    tree?: boolean;
    [key: string]: any;
  }

  interface AssignMemberRequest {
    group_id: string;
    type: 'users' | 'admin' | 'things' | undefined;
    members: string[];
  }
}
