Update types.ts
This commit is contained in:
163
types.ts
163
types.ts
@@ -3,37 +3,37 @@ export interface Condo {
|
||||
id: string;
|
||||
name: string;
|
||||
address?: string;
|
||||
streetNumber?: string; // Civico
|
||||
city?: string; // Città
|
||||
province?: string; // Provincia
|
||||
zipCode?: string; // CAP
|
||||
notes?: string; // Note
|
||||
streetNumber?: string;
|
||||
city?: string;
|
||||
province?: string;
|
||||
zipCode?: string;
|
||||
notes?: string;
|
||||
iban?: string;
|
||||
paypalClientId?: string; // PayPal Client ID for receiving payments
|
||||
paypalClientId?: string;
|
||||
defaultMonthlyQuota: number;
|
||||
dueDay?: number; // Day of month (1-31) when payment is due. Default 10.
|
||||
image?: string; // Optional placeholder for logo
|
||||
dueDay?: number;
|
||||
image?: string;
|
||||
}
|
||||
|
||||
export interface Family {
|
||||
id: string;
|
||||
condoId: string; // Link to specific condo
|
||||
condoId: string;
|
||||
name: string;
|
||||
unitNumber: string; // Internal apartment number (Interno)
|
||||
stair?: string; // Scala
|
||||
floor?: string; // Piano
|
||||
notes?: string; // Note
|
||||
unitNumber: string;
|
||||
stair?: string;
|
||||
floor?: string;
|
||||
notes?: string;
|
||||
contactEmail?: string;
|
||||
balance: number; // Calculated balance (positive = credit, negative = debt)
|
||||
customMonthlyQuota?: number; // Optional override for default quota
|
||||
balance: number;
|
||||
customMonthlyQuota?: number;
|
||||
}
|
||||
|
||||
export interface Payment {
|
||||
id: string;
|
||||
familyId: string;
|
||||
amount: number;
|
||||
datePaid: string; // ISO Date string
|
||||
forMonth: number; // 1-12
|
||||
datePaid: string;
|
||||
forMonth: number;
|
||||
forYear: number;
|
||||
notes?: string;
|
||||
}
|
||||
@@ -55,6 +55,13 @@ export interface StorageConfig {
|
||||
region?: string;
|
||||
}
|
||||
|
||||
export interface AppBranding {
|
||||
appName: string;
|
||||
appIcon?: string;
|
||||
loginBg?: string;
|
||||
primaryColor: string;
|
||||
}
|
||||
|
||||
export interface AppFeatures {
|
||||
multiCondo: boolean;
|
||||
tickets: boolean;
|
||||
@@ -62,58 +69,27 @@ export interface AppFeatures {
|
||||
notices: boolean;
|
||||
reports: boolean;
|
||||
extraordinaryExpenses: boolean;
|
||||
condoFinancialsView: boolean; // Toggle for User read-only access to Condo Expenses
|
||||
documents: boolean; // NEW: Document Management
|
||||
}
|
||||
|
||||
export interface AlertDefinition {
|
||||
id: string;
|
||||
subject: string;
|
||||
body: string;
|
||||
daysOffset: number; // Number of days
|
||||
offsetType: 'before_next_month' | 'after_current_month';
|
||||
sendHour: number; // 0-23
|
||||
active: boolean;
|
||||
lastSent?: string; // ISO Date of last execution
|
||||
}
|
||||
|
||||
export type NoticeIconType = 'info' | 'warning' | 'maintenance' | 'event';
|
||||
|
||||
export interface Notice {
|
||||
id: string;
|
||||
condoId: string;
|
||||
title: string;
|
||||
content: string;
|
||||
type: NoticeIconType;
|
||||
link?: string;
|
||||
date: string; // ISO Date
|
||||
active: boolean;
|
||||
targetFamilyIds?: string[]; // Array of family IDs. If empty/null, it means "ALL"
|
||||
}
|
||||
|
||||
export interface NoticeRead {
|
||||
userId: string;
|
||||
noticeId: string;
|
||||
readAt: string;
|
||||
condoFinancialsView: boolean;
|
||||
documents: boolean;
|
||||
}
|
||||
|
||||
export interface AppSettings {
|
||||
// Global settings only
|
||||
currentYear: number; // The active fiscal year (could be per-condo, but global for simplicity now)
|
||||
currentYear: number;
|
||||
smtpConfig?: SmtpConfig;
|
||||
storageConfig?: StorageConfig; // NEW: Cloud storage settings
|
||||
storageConfig?: StorageConfig;
|
||||
features: AppFeatures;
|
||||
branding: AppBranding; // NEW
|
||||
}
|
||||
|
||||
export enum PaymentStatus {
|
||||
PAID = 'PAID',
|
||||
UNPAID = 'UNPAID', // Past due (Overdue)
|
||||
UPCOMING = 'UPCOMING', // Future
|
||||
PENDING = 'PENDING' // Due soon (within 10 days window)
|
||||
UNPAID = 'UNPAID',
|
||||
UPCOMING = 'UPCOMING',
|
||||
PENDING = 'PENDING'
|
||||
}
|
||||
|
||||
export interface MonthStatus {
|
||||
monthIndex: number; // 0-11
|
||||
monthIndex: number;
|
||||
status: PaymentStatus;
|
||||
payment?: Payment;
|
||||
}
|
||||
@@ -133,7 +109,6 @@ export interface AuthResponse {
|
||||
user: User;
|
||||
}
|
||||
|
||||
// --- DOCUMENTS ---
|
||||
export interface Document {
|
||||
id: string;
|
||||
condoId: string;
|
||||
@@ -142,20 +117,18 @@ export interface Document {
|
||||
fileName: string;
|
||||
fileType: string;
|
||||
fileSize: number;
|
||||
tags: string[]; // Array of tag strings
|
||||
tags: string[];
|
||||
uploadDate: string;
|
||||
storageProvider: string; // 'local_db', 's3', etc.
|
||||
url?: string; // Signed URL or base64 data depending on provider
|
||||
storageProvider: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
// --- TICKETS ---
|
||||
|
||||
export enum TicketStatus {
|
||||
OPEN = 'OPEN',
|
||||
IN_PROGRESS = 'IN_PROGRESS',
|
||||
SUSPENDED = 'SUSPENDED', // New State
|
||||
SUSPENDED = 'SUSPENDED',
|
||||
RESOLVED = 'RESOLVED',
|
||||
CLOSED = 'CLOSED' // Closed without resolution (Archived/WontFix)
|
||||
CLOSED = 'CLOSED'
|
||||
}
|
||||
|
||||
export enum TicketPriority {
|
||||
@@ -166,19 +139,19 @@ export enum TicketPriority {
|
||||
}
|
||||
|
||||
export enum TicketCategory {
|
||||
MAINTENANCE = 'MAINTENANCE', // Manutenzione
|
||||
ADMINISTRATIVE = 'ADMINISTRATIVE', // Amministrativa
|
||||
NOISE = 'NOISE', // Disturbo/Rumori
|
||||
CLEANING = 'CLEANING', // Pulizie
|
||||
OTHER = 'OTHER' // Altro
|
||||
MAINTENANCE = 'MAINTENANCE',
|
||||
ADMINISTRATIVE = 'ADMINISTRATIVE',
|
||||
NOISE = 'NOISE',
|
||||
CLEANING = 'CLEANING',
|
||||
OTHER = 'OTHER'
|
||||
}
|
||||
|
||||
export interface TicketAttachment {
|
||||
id: string;
|
||||
ticketId: string;
|
||||
fileName: string;
|
||||
fileType: string; // MIME type
|
||||
data: string; // Base64 Data URI
|
||||
fileType: string;
|
||||
data: string;
|
||||
}
|
||||
|
||||
export interface TicketComment {
|
||||
@@ -204,12 +177,10 @@ export interface Ticket {
|
||||
updatedAt: string;
|
||||
attachments?: TicketAttachment[];
|
||||
comments?: TicketComment[];
|
||||
userName?: string; // Joined field
|
||||
userEmail?: string; // Joined field
|
||||
userName?: string;
|
||||
userEmail?: string;
|
||||
}
|
||||
|
||||
// --- EXTRAORDINARY EXPENSES ---
|
||||
|
||||
export interface ExpenseItem {
|
||||
id?: string;
|
||||
description: string;
|
||||
@@ -223,7 +194,7 @@ export interface ExpenseShare {
|
||||
amountDue: number;
|
||||
amountPaid: number;
|
||||
status: 'PAID' | 'PARTIAL' | 'UNPAID';
|
||||
familyName?: string; // Joined
|
||||
familyName?: string;
|
||||
}
|
||||
|
||||
export interface ExtraordinaryExpense {
|
||||
@@ -236,20 +207,18 @@ export interface ExtraordinaryExpense {
|
||||
contractorName: string;
|
||||
totalAmount: number;
|
||||
items: ExpenseItem[];
|
||||
shares?: ExpenseShare[]; // For detail view
|
||||
shares?: ExpenseShare[];
|
||||
attachments?: { id: string, fileName: string, fileType: string, data: string }[];
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
// --- CONDO ORDINARY EXPENSES (USCITE) ---
|
||||
|
||||
export interface CondoExpense {
|
||||
id: string;
|
||||
condoId: string;
|
||||
description: string;
|
||||
supplierName: string;
|
||||
amount: number;
|
||||
paymentDate: string | null; // Null if not paid yet
|
||||
paymentDate: string | null;
|
||||
status: 'PAID' | 'UNPAID' | 'SUSPENDED';
|
||||
paymentMethod?: string;
|
||||
invoiceNumber?: string;
|
||||
@@ -257,3 +226,35 @@ export interface CondoExpense {
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user