export interface User {
  id: string;
  email: string; // Enforces "Firstname.Lastname@myusako.org" format
  name: string;
  role: 'admin' | 'employee';
  allowedTools: string[]; // List of tool keys they can use: 'email', 'phone', 'civicrm', 'rover', 'helpdesk', 'forms'
  createdAt: string;
  extension?: string; // One-click sign-in extension number
  inCallQueue?: boolean; // Active check-in state in call queue
}

export interface Email {
  id: string;
  sender: string;
  recipient: string;
  subject: string;
  body: string;
  timestamp: string;
  read: boolean;
  folder: 'inbox' | 'sent' | 'draft';
}

export interface Voicemail {
  id: string;
  callerName: string;
  callerNumber: string;
  timestamp: string;
  duration: string;
  transcript: string;
  audioUrl?: string;
  read: boolean;
}

export interface CallRecord {
  id: string;
  direction: 'inbound' | 'outbound';
  phoneNumber: string;
  name: string;
  timestamp: string;
  duration: string;
  status: 'completed' | 'missed' | 'voicemail';
}

export interface CaseRecord {
  id: string;
  clientName: string;
  caseType: 'Housing' | 'Medical' | 'Food Assistance' | 'Job Placement' | 'Legal' | 'Mental Health';
  status: 'Open' | 'In Progress' | 'Closed';
  assignedTo: string;
  description: string;
  lastUpdated: string;
}

export interface DonationRecord {
  id: string;
  donorName: string;
  amount: number;
  date: string;
  paymentMethod: 'Credit Card' | 'Check' | 'Bank Transfer' | 'Cash' | 'Online';
  campaign: 'General Fund' | 'Relief Rover' | 'Homeless Outreach' | 'Winter Shelter';
  notes?: string;
}

export interface ScheduledStop {
  id: string;
  crossStreets: string; // Only cross streets, no specific addresses
  scheduledTime: '10:00 AM' | '11:30 AM' | '2:00 PM' | '3:30 PM';
  scheduledDate: string; // YYYY-MM-DD
  status: 'Pending' | 'Approved' | 'Completed' | 'Cancelled';
  requesterName: string;
  requesterEmail: string;
  createdAt: string;
}

export interface RoverRouteStop {
  order: number;
  crossStreets: string;
  priority: 'High' | 'Medium' | 'Low';
  reason: string; // E.g., "High activity based on police reports / requested stop"
  estimatedArrival: string;
  source: 'User Request' | 'AI Prediction';
}

export interface RoverState {
  isTrackingLive: boolean;
  currentLatitude: number;
  currentLongitude: number;
  lastRouteProcessedAt?: string;
  activeRoute: RoverRouteStop[];
}

export interface SharedForm {
  id: string;
  title: string;
  category: string;
  description: string;
  url: string;
  submittedBy?: string;
  submittedAt?: string;
}

export interface PasswordResetRequest {
  id: string;
  email: string;
  timestamp: string;
  status: 'Pending' | 'Reset';
}

export interface SystemSettings {
  twilioEmail: string;
  twilioPhone: string;
  twilioSid: string;
  twilioSecret: string;
  vapiEmail: string;
  vapiPhone: string;
  vapiPrivateKey: string;
  vapiAccountId: string;
  vapiPublicKey: string;
  elevenLabsKey: string;
  openaiKey1: string;
  openrouterKey: string;
  openaiKey2: string;
  githubPat: string;
  googleStudioKey: string;
}

export interface ClientActivity {
  id: string;
  serviceType: string; // 'Bicycle Repair Station', 'Secured Pet Cages', etc.
  timestamp: string;
  loggedBy: string; // User email
  notes?: string;
}

export interface ClientIntake {
  housingStatus: 'Unsheltered' | 'Temporary Shelter' | 'Permanent Housing' | 'Other';
  hasIncome: boolean;
  veteranStatus: boolean;
  needsAssessment: string;
  primaryNeeds: string[]; // E.g., ["Food", "Shelter", "Medical"]
  intakeDate: string;
}

export interface Client {
  id: string;
  name: string;
  phone?: string;
  email?: string;
  dob?: string;
  gender?: string;
  notes?: string;
  createdAt: string;
  intake?: ClientIntake;
  activities: ClientActivity[];
}

export interface PhoneExtension {
  id: string;
  extensionNumber: string;
  assignedUserEmail: string;
  status: 'active' | 'inactive';
  vapiBotConfig?: string;
}

