// API Response Types
export interface ApiResponse<T = any> {
  message?: T;
  error?: string;
  status_code?: number;
}

// User Types
export interface UserDetails {
  user_id: string;
  full_name: string;
  email: string;
  user_image?: string;
  roles: string[];
  permissions: Record<string, {
    read: boolean;
    write: boolean;
    create: boolean;
    delete: boolean;
  }>;
  last_login?: string;
  enabled: boolean;
  creation: string;
  modified: string;
  language: string;
}

// DocType Record Types
export interface DocTypeRecord {
  name: string;
  creation: string;
  modified: string;
  modified_by: string;
  owner: string;
  docstatus: number;
  [key: string]: any; // Allow additional fields
}

export interface DocTypeRecordsResponse {
  records: DocTypeRecord[];
  total_count: number;
  limit: number;
  offset: number;
  has_more: boolean;
  doctype: string;
}

// Dashboard Types
export interface DashboardStats {
  total_users: number;
  total_customers: number;
  total_items: number;
  total_orders: number;
  recent_activities: RecentActivity[];
}

export interface RecentActivity {
  type: string;
  name: string;
  title: string;
  creation: string;
}

// KYC Types
export interface KycRecord {
  name: string;
  kyc_status: string;
  kyc_type: string;
  creation: string;
  modified: string;
}

export interface KycDetailsResponse {
  records: KycRecord[];
  summary: {
    total: number;
    pending: number;
    approved: number;
  };
}

// API Configuration Types
export interface ApiConfig {
  BASE_URL: string;
  ENDPOINTS: Record<string, string>;
  DEFAULT_HEADERS: Record<string, string>;
  TIMEOUT: number;
}

// Request Options
export interface RequestOptions {
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
  headers?: Record<string, string>;
  body?: any;
}

// Error Types
export interface ApiError {
  message: string;
  status?: number;
  code?: string;
}

// Login Types
export interface LoginResponse {
  message: {
    full_name: string;
    user_id: string;
    sid: string;
  };
}

export interface LoginCredentials {
  email: string;
  password: string;
}

// File Upload Types
export interface FileUploadOptions {
  file: File;
  doctype: string;
  docname: string;
  fieldname: string;
}
