export type LeadStatus =
  | "open"
  | "contacted"
  | "pending"
  | "closed"
  | "ignored";
export type UserRole = "super_admin" | "admin" | "sales";

export interface User {
  id: string;
  name: string;
  email: string;
  role: UserRole;
  active: boolean;
  avatar: string;
  createdAt: string;
}

export interface Lead {
  id: string;
  companyName: string;
  contactName: string;
  email: string;
  phone: string;
  source: string;
  description: string;
  status: LeadStatus;
  assignedUserId: string | null;
  assignedUser: User | null;
  createdAt: string;
  updatedAt: string;
}

export interface Note {
  id: string;
  leadId: string;
  userId: string;
  authorName: string;
  authorAvatar: string;
  authorRole: UserRole;
  note: string;
  createdAt: string;
  updatedAt: string;
}

export interface DashboardStats {
  totalLeads: number;
  openLeads: number;
  contactedLeads: number;
  pendingLeads: number;
  closedLeads: number;
  ignoredLeads: number;
  conversionRate: number;
  monthlyBreakdown: { label: string; total: number; open: number; contacted: number; pending: number; closed: number; ignored: number }[];
  leadsPerMonth: { label: string; leads: number; closed: number }[];
  recentLeads: Lead[];
  statusDistribution: { name: string; value: number; color: string }[];
  periodLabel: string;
  trends: {
    totalLeads: { pct: number; up: boolean };
    openLeads: { pct: number; up: boolean };
    contactedLeads: { pct: number; up: boolean };
    pendingLeads: { pct: number; up: boolean };
    closedLeads: { pct: number; up: boolean };
    ignoredLeads: { pct: number; up: boolean };
    conversionRate: { pct: number; up: boolean };
  };
}

export interface ColumnFilter {
  id: string;
  value: unknown;
}

export type NotificationType =
  | "lead_created"
  | "lead_status_changed"
  | "lead_assigned"
  | "chat_message"
  | "note_added";

export interface Notification {
  id: string;
  type: NotificationType;
  title: string;
  description: string;
  timestamp: string;
  read: boolean;
  link?: string;
}

export interface ChatMessage {
  id: string;
  conversationId: string;
  senderId: string;
  senderName: string;
  senderAvatar: string;
  content: string;
  timestamp: string;
}

export interface Conversation {
  id: string;
  participants: { id: string; name: string; avatar: string; role: string }[];
  lastMessage: string;
  lastMessageTime: string;
  unread: number;
  messages: ChatMessage[];
}
