Files
omnisupport-ai/types.ts
2026-02-17 11:26:05 +01:00

189 lines
4.0 KiB
TypeScript

export enum TicketStatus {
OPEN = 'APERTO',
IN_PROGRESS = 'IN LAVORAZIONE',
RESOLVED = 'RISOLTO',
CLOSED = 'CHIUSO'
}
export enum TicketPriority {
LOW = 'Bassa',
MEDIUM = 'Media',
HIGH = 'Alta',
CRITICAL = 'Critica'
}
export interface Attachment {
id: string;
name: string;
url: string; // Mock URL
type: string;
}
export interface TicketQueue {
id: string;
name: string;
description?: string;
}
export interface AgentAvatarConfig {
x: number; // Percentage offset X
y: number; // Percentage offset Y
scale: number; // Zoom level (1 = 100%)
}
export type AgentRole = 'superadmin' | 'supervisor' | 'agent';
export interface Agent {
id: string;
name: string;
email: string;
password?: string;
role: AgentRole; // Added Role
avatar: string;
avatarConfig?: AgentAvatarConfig; // Added positioning config
skills: string[];
queues: string[];
}
export interface ClientUser {
id: string;
name: string;
email: string;
password?: string; // Mock password
company?: string;
status: 'active' | 'inactive';
}
export interface Ticket {
id: string;
subject: string;
description: string;
status: TicketStatus;
priority: TicketPriority;
assignedAgentId?: string;
queue: string; // e.g., 'Technical', 'Billing'
createdAt: string;
customerName: string;
messages: ChatMessage[];
attachments: Attachment[]; // Added attachments
hasBeenAnalyzed?: boolean; // New flag to prevent duplicate AI analysis
}
export interface KBArticle {
id: string;
title: string;
content: string; // HTML or Markdown
category: string;
type: 'article' | 'url';
url?: string;
source?: 'manual' | 'ai'; // Track if created by AI for quotas
visibility: 'public' | 'internal'; // New visibility flag
lastUpdated: string;
}
export interface ChatMessage {
id: string;
role: 'user' | 'assistant' | 'system';
content: string;
timestamp: string;
}
export interface SurveyResult {
id: string;
rating: number; // 1-5
comment?: string;
source: 'chat' | 'ticket';
referenceId?: string; // ticketId
timestamp: string;
}
export interface BrandingConfig {
appName: string;
primaryColor: string;
logoUrl: string;
}
export interface SmtpConfig {
host: string;
port: number;
user: string;
pass: string;
secure: boolean;
fromEmail: string;
}
export enum EmailTrigger {
TICKET_CREATED = 'ticket_created',
STATUS_CHANGED = 'status_changed',
AGENT_ASSIGNED = 'agent_assigned',
NEW_REPLY = 'new_reply',
SURVEY_REQUEST = 'survey_request'
}
export enum EmailAudience {
CLIENT = 'client',
STAFF = 'staff'
}
export interface EmailTemplate {
id: string;
name: string;
trigger: EmailTrigger;
audience: EmailAudience;
subject: string;
body: string;
isActive: boolean;
}
export interface FeatureConfig {
kbEnabled: boolean;
maxKbArticles: number;
maxSupervisors: number;
aiKnowledgeAgentEnabled: boolean;
maxAiGeneratedArticles: number;
maxAgents: number;
}
export enum AiProvider {
GEMINI = 'gemini',
OPENROUTER = 'openrouter',
OPENAI = 'openai',
ANTHROPIC = 'anthropic',
DEEPSEEK = 'deepseek',
OLLAMA = 'ollama', // Self-hosted
HUGGINGFACE = 'huggingface' // Free tier available
}
export interface AiConfig {
provider: AiProvider;
apiKey: string;
model: string;
baseUrl?: string; // For self-hosted/custom endpoints
isActive: boolean;
// Customization fields
agentName?: string;
agentAvatar?: string;
customPrompt?: string;
}
export interface AppSettings {
branding: BrandingConfig;
smtp: SmtpConfig;
emailTemplates: EmailTemplate[];
features: FeatureConfig;
aiConfig: AiConfig; // New AI Configuration
}
export interface AppState {
tickets: Ticket[];
articles: KBArticle[];
agents: Agent[];
queues: TicketQueue[]; // Added Queues
surveys: SurveyResult[];
clientUsers: ClientUser[];
settings: AppSettings;
currentUser: ClientUser | Agent | null; // Changed to object or null
userRole: 'client' | AgentRole | 'guest'; // Updated to include specific agent roles
}