-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
87 lines (76 loc) · 2.14 KB
/
Copy pathtypes.ts
File metadata and controls
87 lines (76 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
export enum PackageType {
INDEPENDENT = 'independent',
LOCAL = 'local',
SMART = 'smart'
}
export enum BuildingType {
RESIDENTIAL = 'residential',
WAREHOUSE = 'warehouse'
}
export type CalcMethodType =
| 'per_room' // Tính theo số phòng (thường là phòng ngủ)
| 'per_kitchen_altar' // Tính theo phòng bếp/thờ
| 'per_area' // Tính theo diện tích (1 cái / X m2)
| 'per_floor' // Tính theo số tầng (1 cái / X tầng, hoặc X cái / 1 tầng)
| 'per_floor_bell' // Tính chuông báo cháy (hành lang)
| 'per_building'; // Cố định (vd: 1 Tủ trung tâm / công trình)
export interface CalcMethod {
type: CalcMethodType;
value?: number; // Parameter for the calculation (e.g. area per detector, floors per cabinet). Defaults to 1 if not needed.
}
export interface Equipment {
id: string;
name: string;
price: number;
description: string;
icon: string;
isDefault?: boolean; // Nếu là thiết bị gốc của ứng dụng (không thể xoá)
calcMethod: CalcMethod;
}
export interface UserInput {
buildingType: BuildingType;
floors: number;
rooms: number;
kitchenAltar: number;
totalArea: number;
// Warehouse-specific
storageType?: 'general' | 'flammable' | 'chemical'; // loại hàng hóa
ceilingHeight?: number; // chiều cao trần (m)
}
export interface ResidentialRules {
cabinetPerFloors: number;
smokePerRoom: number;
heatPerKitchenAltar: number;
}
export interface WarehouseRules {
smokeDetectorArea: number; // m2/đầu khói
cabinetArea: number; // m2/tủ (nếu tính theo diện tích)
}
export interface FireSafetyConfig {
equipments: Equipment[];
rules: {
residential: ResidentialRules;
warehouse: WarehouseRules;
};
updatedAt?: string;
}
export interface EstimationResult {
totalCost: number;
equipmentList: {
id: string;
name: string;
quantity: number;
unitPrice: number;
totalPrice: number;
note: string;
icon: string;
}[];
}
export interface SavedProject {
id: string;
name: string;
userInput: UserInput;
packageType: PackageType;
estimation: EstimationResult;
createdAt: string;
}