Files
Condopay/types.ts
2025-12-18 21:03:08 +01:00

261 lines
4.9 KiB
TypeScript

export interface Condo {
id: string;
name: string;
address?: string;
streetNumber?: string;
city?: string;
province?: string;
zipCode?: string;
notes?: string;
iban?: string;
paypalClientId?: string;
defaultMonthlyQuota: number;
dueDay?: number;
image?: string;
}
export interface Family {
id: string;
condoId: string;
name: string;
unitNumber: string;
stair?: string;
floor?: string;
notes?: string;
contactEmail?: string;
balance: number;
customMonthlyQuota?: number;
}
export interface Payment {
id: string;
familyId: string;
amount: number;
datePaid: string;
forMonth: number;
forYear: number;
notes?: string;
}
export interface SmtpConfig {
host: string;
port: number;
user: string;
pass: string;
secure: boolean;
fromEmail: string;
}
export interface StorageConfig {
provider: 'local_db' | 's3' | 'google_drive' | 'dropbox' | 'onedrive';
apiKey?: string;
apiSecret?: string;
bucket?: string;
region?: string;
}
export interface AppBranding {
appName: string;
appIcon?: string;
loginBg?: string;
primaryColor: string;
}
export interface AppFeatures {
multiCondo: boolean;
tickets: boolean;
payPal: boolean;
notices: boolean;
reports: boolean;
extraordinaryExpenses: boolean;
condoFinancialsView: boolean;
documents: boolean;
}
export interface AppSettings {
currentYear: number;
smtpConfig?: SmtpConfig;
storageConfig?: StorageConfig;
features: AppFeatures;
branding: AppBranding; // NEW
}
export enum PaymentStatus {
PAID = 'PAID',
UNPAID = 'UNPAID',
UPCOMING = 'UPCOMING',
PENDING = 'PENDING'
}
export interface MonthStatus {
monthIndex: number;
status: PaymentStatus;
payment?: Payment;
}
export interface User {
id: string;
email: string;
name?: string;
role?: 'admin' | 'poweruser' | 'user';
phone?: string;
familyId?: string | null;
receiveAlerts?: boolean;
}
export interface AuthResponse {
token: string;
user: User;
}
export interface Document {
id: string;
condoId: string;
title: string;
description?: string;
fileName: string;
fileType: string;
fileSize: number;
tags: string[];
uploadDate: string;
storageProvider: string;
url?: string;
}
export enum TicketStatus {
OPEN = 'OPEN',
IN_PROGRESS = 'IN_PROGRESS',
SUSPENDED = 'SUSPENDED',
RESOLVED = 'RESOLVED',
CLOSED = 'CLOSED'
}
export enum TicketPriority {
LOW = 'LOW',
MEDIUM = 'MEDIUM',
HIGH = 'HIGH',
URGENT = 'URGENT'
}
export enum TicketCategory {
MAINTENANCE = 'MAINTENANCE',
ADMINISTRATIVE = 'ADMINISTRATIVE',
NOISE = 'NOISE',
CLEANING = 'CLEANING',
OTHER = 'OTHER'
}
export interface TicketAttachment {
id: string;
ticketId: string;
fileName: string;
fileType: string;
data: string;
}
export interface TicketComment {
id: string;
ticketId: string;
userId: string;
userName: string;
text: string;
createdAt: string;
isAdminResponse: boolean;
}
export interface Ticket {
id: string;
condoId: string;
userId: string;
title: string;
description: string;
status: TicketStatus;
priority: TicketPriority;
category: TicketCategory;
createdAt: string;
updatedAt: string;
attachments?: TicketAttachment[];
comments?: TicketComment[];
userName?: string;
userEmail?: string;
}
export interface ExpenseItem {
id?: string;
description: string;
amount: number;
}
export interface ExpenseShare {
id?: string;
familyId: string;
percentage: number;
amountDue: number;
amountPaid: number;
status: 'PAID' | 'PARTIAL' | 'UNPAID';
familyName?: string;
}
export interface ExtraordinaryExpense {
id: string;
condoId: string;
title: string;
description: string;
startDate: string;
endDate?: string;
contractorName: string;
totalAmount: number;
items: ExpenseItem[];
shares?: ExpenseShare[];
attachments?: { id: string, fileName: string, fileType: string, data: string }[];
createdAt: string;
}
export interface CondoExpense {
id: string;
condoId: string;
description: string;
supplierName: string;
amount: number;
paymentDate: string | null;
status: 'PAID' | 'UNPAID' | 'SUSPENDED';
paymentMethod?: string;
invoiceNumber?: string;
notes?: string;
createdAt: string;
attachments?: { id: string, fileName: string, fileType: string, data: string }[];
}
export interface Notice {
id: string;
condoId: string;
title: string;
content: string;
type: 'info' | 'warning' | 'maintenance' | 'event';
link?: string;
date: string;
active: boolean;
targetFamilyIds?: string[];
}
export interface NoticeRead {
userId: string;
noticeId: string;
readAt: string;
}
// Fixed missing exports required by settings and services
export type NoticeIconType = 'info' | 'warning' | 'maintenance' | 'event';
export interface AlertDefinition {
id: string;
condoId: string;
subject: string;
body: string;
daysOffset: number;
offsetType: string;
sendHour: number;
active: boolean;
}