133 lines
3.1 KiB
TypeScript
133 lines
3.1 KiB
TypeScript
import { Timestamp } from 'firebase/firestore';
|
|
|
|
export interface User {
|
|
uid: string;
|
|
email: string;
|
|
displayName?: string;
|
|
onboardingCompleted?: boolean;
|
|
creditBalance: number; // in EUR/credits
|
|
createdAt: Timestamp;
|
|
updatedAt: Timestamp;
|
|
}
|
|
|
|
export interface AgentSettings {
|
|
userId: string;
|
|
agentName: string; // default "HolaCompi"
|
|
appLanguage: string; // fixed "English" for v1
|
|
primaryCallLanguage: string; // default "English"
|
|
secondaryCallLanguages: string[]; // e.g., ["Spanish"]
|
|
tone: 'Friendly' | 'Professional' | 'Assertive';
|
|
agentInstructions: string; // system prompt
|
|
createdAt: Timestamp;
|
|
updatedAt: Timestamp;
|
|
}
|
|
|
|
export interface CallTask {
|
|
id: string;
|
|
userId: string;
|
|
businessName: string;
|
|
phoneNumber: string;
|
|
preferredLanguage: string; // "English" or "Spanish"
|
|
callGoals: string; // multi-line text
|
|
scheduledAt: Timestamp;
|
|
timezone?: string;
|
|
maxMinutes: number;
|
|
maxCredits: number; // same as maxMinutes for v1
|
|
allowRecalls: boolean;
|
|
maxRecalls: number;
|
|
recallsUsed: number;
|
|
status: 'pending' | 'in_progress' | 'completed' | 'failed';
|
|
lastResult?: string;
|
|
createdAt: Timestamp;
|
|
updatedAt: Timestamp;
|
|
}
|
|
|
|
export interface CallAttempt {
|
|
id: string;
|
|
taskId: string;
|
|
startTime: Timestamp;
|
|
endTime?: Timestamp;
|
|
duration: number; // minutes
|
|
creditsUsed: number;
|
|
status: 'in_progress' | 'completed' | 'hangup_other_party' | 'failed' | 'busy';
|
|
transcript?: string;
|
|
summary?: string;
|
|
vapiCallId?: string;
|
|
createdAt: Timestamp;
|
|
}
|
|
|
|
export interface CallRecord {
|
|
id: string;
|
|
userId: string;
|
|
phoneNumber: string;
|
|
status: 'initiated' | 'started' | 'ended' | 'failed';
|
|
vapiCallId?: string;
|
|
assistantId?: string;
|
|
scheduledTaskId?: string;
|
|
startedAt?: Timestamp;
|
|
endedAt?: Timestamp;
|
|
durationSeconds?: number;
|
|
creditsUsed?: number;
|
|
recordingUrl?: string;
|
|
transcript?: string;
|
|
createdAt: Timestamp;
|
|
updatedAt: Timestamp;
|
|
}
|
|
|
|
export interface CreditTransaction {
|
|
id: string;
|
|
userId: string;
|
|
amount: number; // positive for add, negative for debit
|
|
type: 'purchase' | 'call_debit' | 'refund';
|
|
callTaskId?: string;
|
|
callAttemptId?: string;
|
|
balanceAfter: number;
|
|
createdAt: Timestamp;
|
|
}
|
|
|
|
export interface NotificationSettings {
|
|
userId: string;
|
|
notifyOnSuccess: boolean;
|
|
notifyOnFailure: boolean;
|
|
emailSummary: boolean;
|
|
autoAddToCalendar: boolean;
|
|
googleCalendarConnected: boolean;
|
|
iCloudCalendarConnected: boolean;
|
|
createdAt: Timestamp;
|
|
updatedAt: Timestamp;
|
|
}
|
|
|
|
export interface BookedAppointment {
|
|
id: string;
|
|
userId: string;
|
|
callTaskId: string;
|
|
title: string;
|
|
dateTime: Timestamp;
|
|
location?: string;
|
|
phone?: string;
|
|
notes?: string;
|
|
calendarEventId?: string;
|
|
createdAt: Timestamp;
|
|
}
|
|
|
|
export interface DefaultLimits {
|
|
userId: string;
|
|
defaultMaxMinutes: number;
|
|
defaultMaxCredits: number;
|
|
allowAutoExtension: boolean;
|
|
maxExtraMinutes: number;
|
|
defaultMaxRecalls: number;
|
|
minDelayBetweenRecalls: number; // minutes
|
|
updatedAt: Timestamp;
|
|
}
|
|
|
|
export interface Purchase {
|
|
id: string;
|
|
userId: string;
|
|
credits: number;
|
|
amount: number; // EUR amount
|
|
currency: string;
|
|
stripeSessionId: string;
|
|
createdAt: Timestamp;
|
|
}
|