227 lines
4.6 KiB
TypeScript
227 lines
4.6 KiB
TypeScript
export interface User {
|
|
id: string;
|
|
firstName: string;
|
|
lastName: string;
|
|
email: string;
|
|
phone?: string;
|
|
isActive: boolean;
|
|
lastLoginAt?: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
roleAssignments?: RoleAssignment[];
|
|
}
|
|
|
|
export interface RoleAssignment {
|
|
id: string;
|
|
userId: string;
|
|
role: string;
|
|
createdAt: string;
|
|
}
|
|
|
|
export interface AuthUser {
|
|
id: string;
|
|
email: string;
|
|
firstName?: string;
|
|
lastName?: string;
|
|
name?: string;
|
|
role?: string;
|
|
}
|
|
|
|
export interface AuthState {
|
|
user: AuthUser | null;
|
|
accessToken: string | null;
|
|
tenantSlug: string | null;
|
|
isAuthenticated: boolean;
|
|
login: (tenantSlug: string, email: string, password: string) => Promise<void>;
|
|
logout: () => void;
|
|
}
|
|
|
|
export interface Client {
|
|
id: string;
|
|
tenantId: string;
|
|
accountNumber: string;
|
|
firstName: string;
|
|
lastName: string;
|
|
email: string;
|
|
phone: string;
|
|
address?: string;
|
|
isActive: boolean;
|
|
lat?: number | null;
|
|
lng?: number | null;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
area?: { id: string; name: string };
|
|
subscriptions?: Subscription[];
|
|
}
|
|
|
|
export interface Subscription {
|
|
id: string;
|
|
clientId: string;
|
|
planId: string;
|
|
plan?: Plan;
|
|
status: string;
|
|
type?: string;
|
|
startDate: string;
|
|
endDate?: string;
|
|
monthlyRate?: number;
|
|
mrc?: number;
|
|
monthlyPrice?: number | string;
|
|
createdAt: string;
|
|
}
|
|
|
|
export interface Plan {
|
|
id: string;
|
|
name: string;
|
|
type: string;
|
|
speedDownMbps: number;
|
|
speedUpMbps: number;
|
|
monthlyPrice: number;
|
|
isActive: boolean;
|
|
}
|
|
|
|
export interface Invoice {
|
|
id: string;
|
|
invoiceNumber?: string;
|
|
clientId: string;
|
|
client?: { firstName: string; lastName: string; accountNumber: string };
|
|
amount: number;
|
|
totalAmount?: number;
|
|
dueDate: string;
|
|
status: string;
|
|
paidAt?: string;
|
|
createdAt: string;
|
|
}
|
|
|
|
export interface Payment {
|
|
id: string;
|
|
clientId: string;
|
|
client?: { firstName: string; lastName: string; accountNumber: string };
|
|
amount: number;
|
|
channel: string;
|
|
reference?: string;
|
|
referenceNumber?: string;
|
|
status: string;
|
|
date?: string;
|
|
paymentDate?: string;
|
|
createdAt: string;
|
|
}
|
|
|
|
export interface Ticket {
|
|
id: string;
|
|
ticketNumber?: string;
|
|
subject: string;
|
|
description?: string;
|
|
clientId?: string;
|
|
client?: { id: string; firstName: string; lastName: string; accountNumber: string };
|
|
type: string;
|
|
priority: string;
|
|
status: string;
|
|
assignedToId?: string;
|
|
assignedTo?: { id: string; firstName: string; lastName: string } | string;
|
|
assignedUser?: { id: string; firstName: string; lastName: string };
|
|
createdById?: string;
|
|
createdBy?: { firstName: string; lastName: string };
|
|
resolvedAt?: string;
|
|
updatedAt?: string;
|
|
createdAt: string;
|
|
}
|
|
|
|
export interface Remittance {
|
|
id: string;
|
|
collectorId?: string;
|
|
collector?: { firstName: string; lastName: string };
|
|
amount: number | string;
|
|
notes?: string;
|
|
status: string;
|
|
payments?: Payment[];
|
|
createdAt: string;
|
|
updatedAt?: string;
|
|
}
|
|
|
|
export interface Task {
|
|
id: string;
|
|
title: string;
|
|
type: string;
|
|
status: string;
|
|
assignedTo?: string;
|
|
assignedUser?: { firstName: string; lastName: string };
|
|
dueDate?: string;
|
|
ticketId?: string;
|
|
ticket?: { subject: string };
|
|
createdAt: string;
|
|
}
|
|
|
|
export interface AuditLog {
|
|
id: string;
|
|
userId?: string;
|
|
user?: { firstName: string; lastName: string; email: string };
|
|
action: string;
|
|
entity?: string;
|
|
entityType?: string;
|
|
entityId?: string;
|
|
details?: Record<string, unknown>;
|
|
createdAt: string;
|
|
}
|
|
|
|
export interface DashboardSummary {
|
|
subscribers: {
|
|
total: number;
|
|
active: number;
|
|
pending: number;
|
|
suspended: number;
|
|
};
|
|
billing: {
|
|
unpaidInvoices: number;
|
|
overdueInvoices: number;
|
|
};
|
|
support: {
|
|
openTickets: number;
|
|
inProgressTickets: number;
|
|
};
|
|
tasks: {
|
|
pending: number;
|
|
};
|
|
revenue: {
|
|
thisMonth: number;
|
|
lastMonth: number;
|
|
growth: number | null;
|
|
};
|
|
}
|
|
|
|
export interface Meta {
|
|
total: number;
|
|
page: number;
|
|
limit: number;
|
|
totalPages: number;
|
|
}
|
|
|
|
export interface PaginatedResponse<T> {
|
|
data: T[];
|
|
meta: Meta;
|
|
}
|
|
|
|
// For /users which returns plain array
|
|
export type UsersResponse = User[];
|
|
|
|
// For invoices/payments which return { data, total, page, limit }
|
|
export interface LegacyPaginatedResponse<T> {
|
|
data: T[];
|
|
total: number;
|
|
page: number;
|
|
limit: number;
|
|
}
|
|
|
|
export interface Lead {
|
|
id: string;
|
|
firstName: string;
|
|
lastName: string;
|
|
phone: string;
|
|
email?: string;
|
|
address?: string;
|
|
status: 'NEW' | 'CONTACTED' | 'INTERESTED' | 'CONVERTED' | 'LOST';
|
|
source?: string;
|
|
notes?: string;
|
|
assignedTo?: { firstName: string; lastName: string };
|
|
createdAt: string;
|
|
}
|