export const ADMIN_QUERY_REPOSITORY = Symbol('ADMIN_QUERY_REPOSITORY');

export interface ModerationQueueItem {
  listingId: string;
  propertyTitle: string;
  propertyType: string;
  transactionType: string;
  priceVND: bigint;
  sellerName: string;
  sellerId: string;
  moderationScore: number | null;
  createdAt: Date;
}

export interface ModerationQueueResult {
  data: ModerationQueueItem[];
  total: number;
  page: number;
  limit: number;
  totalPages: number;
}

export interface DashboardStats {
  totalUsers: number;
  totalListings: number;
  activeListings: number;
  pendingModerationCount: number;
  totalAgents: number;
  verifiedAgents: number;
  totalTransactions: number;
  newUsersLast30Days: number;
  newListingsLast30Days: number;
}

export interface RevenueStatsItem {
  period: string;
  totalRevenue: bigint;
  subscriptionRevenue: bigint;
  listingFeeRevenue: bigint;
  featuredListingRevenue: bigint;
  transactionCount: number;
}

export interface UserListItem {
  id: string;
  email: string | null;
  phone: string;
  fullName: string;
  role: string;
  kycStatus: string;
  isActive: boolean;
  createdAt: Date;
}

export interface UserListResult {
  data: UserListItem[];
  total: number;
  page: number;
  limit: number;
  totalPages: number;
}

export interface UserDetail {
  id: string;
  email: string | null;
  phone: string;
  fullName: string;
  avatarUrl: string | null;
  role: string;
  kycStatus: string;
  kycData: unknown;
  isActive: boolean;
  createdAt: Date;
  updatedAt: Date;
  listingsCount: number;
  activeListingsCount: number;
  transactionsCount: number;
  subscription: {
    planTier: string;
    status: string;
    currentPeriodEnd: Date;
  } | null;
  recentActivity: Array<{
    type: string;
    description: string;
    createdAt: Date;
  }>;
}

export interface KycQueueItem {
  userId: string;
  fullName: string;
  email: string | null;
  phone: string;
  role: string;
  kycStatus: string;
  kycData: unknown;
  createdAt: Date;
}

export interface KycQueueResult {
  data: KycQueueItem[];
  total: number;
  page: number;
  limit: number;
  totalPages: number;
}

export interface IAdminQueryRepository {
  getModerationQueue(page: number, limit: number): Promise<ModerationQueueResult>;
  getDashboardStats(): Promise<DashboardStats>;
  getRevenueStats(startDate: Date, endDate: Date, groupBy: 'day' | 'month'): Promise<RevenueStatsItem[]>;
  getUsers(params: { page: number; limit: number; role?: string; isActive?: boolean; search?: string }): Promise<UserListResult>;
  getUserDetail(userId: string): Promise<UserDetail | null>;
  getKycQueue(page: number, limit: number): Promise<KycQueueResult>;
}
