246 lines
5.7 KiB
TypeScript
246 lines
5.7 KiB
TypeScript
// 用户相关类型
|
|
export interface User {
|
|
id: string;
|
|
email: string;
|
|
full_name?: string;
|
|
avatar_url?: string;
|
|
user_type: 'individual' | 'enterprise';
|
|
phone?: string;
|
|
created_at: string;
|
|
updated_at: string;
|
|
is_active: boolean;
|
|
last_login?: string;
|
|
}
|
|
|
|
// 企业用户扩展信息
|
|
export interface EnterpriseUser extends User {
|
|
company_name: string;
|
|
company_id: string;
|
|
employee_count?: number;
|
|
contract_type: 'monthly' | 'yearly' | 'custom';
|
|
billing_address?: string;
|
|
tax_id?: string;
|
|
}
|
|
|
|
// 账户余额
|
|
export interface AccountBalance {
|
|
user_id: string;
|
|
balance: number;
|
|
currency: 'CNY' | 'USD';
|
|
last_updated: string;
|
|
frozen_amount?: number;
|
|
}
|
|
|
|
// 通话相关类型
|
|
export interface Call {
|
|
id: string;
|
|
caller_id: string;
|
|
callee_id?: string;
|
|
call_type: 'audio' | 'video';
|
|
call_mode: 'ai_voice' | 'ai_video' | 'sign_language' | 'human_interpreter';
|
|
status: 'pending' | 'active' | 'ended' | 'cancelled' | 'failed';
|
|
start_time: string;
|
|
end_time?: string;
|
|
duration?: number; // 秒
|
|
cost: number;
|
|
currency: 'CNY' | 'USD';
|
|
room_sid?: string;
|
|
twilio_call_sid?: string;
|
|
quality_rating?: number;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 通话统计
|
|
export interface CallStats {
|
|
total_calls_today: number;
|
|
active_calls: number;
|
|
average_response_time: number; // 秒
|
|
online_interpreters: number;
|
|
total_revenue_today: number;
|
|
currency: 'CNY' | 'USD';
|
|
}
|
|
|
|
// 翻译员信息
|
|
export interface Interpreter {
|
|
id: string;
|
|
user_id: string;
|
|
name: string;
|
|
avatar_url?: string;
|
|
languages: string[];
|
|
specializations: string[];
|
|
hourly_rate: number;
|
|
currency: 'CNY' | 'USD';
|
|
rating: number;
|
|
total_calls: number;
|
|
status: 'online' | 'offline' | 'busy';
|
|
is_certified: boolean;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 预约信息
|
|
export interface Appointment {
|
|
id: string;
|
|
user_id: string;
|
|
interpreter_id?: string;
|
|
call_type: 'audio' | 'video';
|
|
call_mode: 'ai_voice' | 'ai_video' | 'sign_language' | 'human_interpreter';
|
|
scheduled_time: string;
|
|
duration_minutes: number;
|
|
estimated_cost: number;
|
|
currency: 'CNY' | 'USD';
|
|
status: 'scheduled' | 'confirmed' | 'started' | 'completed' | 'cancelled';
|
|
notes?: string;
|
|
reminder_sent: boolean;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 文档翻译
|
|
export interface DocumentTranslation {
|
|
id: string;
|
|
user_id: string;
|
|
original_filename: string;
|
|
file_url: string;
|
|
file_size: number;
|
|
file_type: string;
|
|
source_language: string;
|
|
target_language: string;
|
|
status: 'uploaded' | 'processing' | 'completed' | 'failed';
|
|
translated_file_url?: string;
|
|
cost: number;
|
|
currency: 'CNY' | 'USD';
|
|
progress_percentage: number;
|
|
estimated_completion?: string;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 订单信息
|
|
export interface Order {
|
|
id: string;
|
|
user_id: string;
|
|
order_type: 'call' | 'document' | 'subscription' | 'recharge';
|
|
related_id?: string; // 关联的通话ID、文档ID等
|
|
amount: number;
|
|
currency: 'CNY' | 'USD';
|
|
status: 'pending' | 'completed' | 'cancelled' | 'refunded';
|
|
payment_method: 'stripe' | 'alipay' | 'wechat' | 'enterprise_billing';
|
|
payment_intent_id?: string;
|
|
invoice_url?: string;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 发票信息
|
|
export interface Invoice {
|
|
id: string;
|
|
user_id: string;
|
|
order_id: string;
|
|
invoice_number: string;
|
|
amount: number;
|
|
currency: 'CNY' | 'USD';
|
|
tax_amount?: number;
|
|
status: 'draft' | 'sent' | 'paid' | 'overdue' | 'cancelled';
|
|
issued_date: string;
|
|
due_date: string;
|
|
paid_date?: string;
|
|
download_url?: string;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 企业员工管理
|
|
export interface EnterpriseEmployee {
|
|
id: string;
|
|
enterprise_id: string;
|
|
user_id: string;
|
|
employee_id: string;
|
|
name: string;
|
|
email: string;
|
|
department?: string;
|
|
position?: string;
|
|
call_limit_per_month?: number;
|
|
is_active: boolean;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 费率规则
|
|
export interface PricingRule {
|
|
id: string;
|
|
name: string;
|
|
service_type: 'audio_call' | 'video_call' | 'document_translation' | 'ai_service';
|
|
call_mode?: 'ai_voice' | 'ai_video' | 'sign_language' | 'human_interpreter';
|
|
base_rate: number;
|
|
currency: 'CNY' | 'USD';
|
|
billing_unit: 'minute' | 'word' | 'page' | 'session';
|
|
minimum_charge: number;
|
|
user_type: 'individual' | 'enterprise' | 'all';
|
|
is_active: boolean;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 通知类型
|
|
export interface Notification {
|
|
id: string;
|
|
user_id: string;
|
|
title: string;
|
|
message: string;
|
|
type: 'info' | 'warning' | 'error' | 'success';
|
|
category: 'system' | 'billing' | 'call' | 'appointment' | 'document';
|
|
is_read: boolean;
|
|
action_url?: string;
|
|
created_at: string;
|
|
}
|
|
|
|
// 系统设置
|
|
export interface SystemSettings {
|
|
id: string;
|
|
key: string;
|
|
value: string;
|
|
description?: string;
|
|
category: 'general' | 'billing' | 'twilio' | 'stripe' | 'elevenlabs';
|
|
is_public: boolean;
|
|
updated_at: string;
|
|
}
|
|
|
|
// API 响应包装类型
|
|
export interface ApiResponse<T = any> {
|
|
success: boolean;
|
|
data?: T;
|
|
error?: string;
|
|
message?: string;
|
|
}
|
|
|
|
// 分页响应类型
|
|
export interface PaginatedResponse<T = any> {
|
|
data: T[];
|
|
total: number;
|
|
page: number;
|
|
limit: number;
|
|
has_more: boolean;
|
|
}
|
|
|
|
// 表格列配置
|
|
export interface TableColumn<T = any> {
|
|
key: keyof T;
|
|
title: string;
|
|
render?: (value: any, record: T) => any;
|
|
sortable?: boolean;
|
|
width?: string;
|
|
align?: 'left' | 'center' | 'right';
|
|
}
|
|
|
|
// 表单字段类型
|
|
export interface FormField {
|
|
name: string;
|
|
label: string;
|
|
type: 'text' | 'email' | 'password' | 'number' | 'select' | 'textarea' | 'file' | 'date' | 'time';
|
|
required?: boolean;
|
|
placeholder?: string;
|
|
options?: Array<{ label: string; value: string | number }>;
|
|
validation?: any;
|
|
}
|