""" Données de départ — modèle à deux niveaux. PARENT (type 'parent') : immobilisation fiscale. Base = somme de ses pièces. PIÈCE (type 'piece') : élément d'inventaire rattaché à un parent. La base amortissable des parents est recalculée par le store ; les valeurs 'capitalizable_base_cad' ci-dessous pour les parents sont indicatives (elles seront écrasées par la somme des pièces). """ def seed_assets() -> list[dict]: return [ # ---------------- PARENT 1 : Serveur Dell ---------------- { "id": 1042, "path": "parent_1042", "type": "parent", "name": "Serveur Dell PowerEdge R760 - Noeud 12", "parent_id": None, "view_admin": { "serial_number": "CN-0H7G4T-79611-3K2-A0B1", "inventory_tag": "DC-QC-SRV-001042", "manufacturer": "Dell", "model": "PowerEdge R760", "form_factor": "2U Rackmount", "canvas": {"x": 0, "y": 0, "width": 260, "height": 150, "z_index": 0}, "operational_status": "Actif", }, "view_cpa": { "original_cost": {"amount": 0, "currency": "CAD"}, "exchange_rate_applied": 1.0, "exchange_rate_date": "2026-02-11", "cost_pre_tax_cad": 0, "non_recoverable_taxes_and_duties": 0.0, "capitalizable_base_cad": 0, "cca_class": {"id": 50, "description": "Matériel informatique", "dpa_rate": 0.55}, "acquisition_date": "2026-02-11", "in_service_date": "2026-02-20", "half_year_rule_applies": True, }, "view_auditor": { "supplier": "Dell Canada Inc.", "invoice_pdf_file_id": "inv_a8f3e1b9-7c4d-4e22-9f10-2b6d5a8e0c33", "invoice_number": "DELL-CA-2026-0044871", "audit_trail": [ {"action": "CREATED", "description": "Immobilisation créée", "timestamp": "2026-02-11T14:32:08-05:00"}, ], }, }, # pièces du parent 1042 _piece(5001, 1042, "RAM DDR5 64GB - Slot 1", "Samsung", "M321R8GA0BB0-CQK", "DIMM", "MEM-DDR5-64-5001", "DC-QC-CMP-005001", 420.00), _piece(5002, 1042, "RAM DDR5 64GB - Slot 2", "Samsung", "M321R8GA0BB0-CQK", "DIMM", "MEM-DDR5-64-5002", "DC-QC-CMP-005002", 420.00), _piece(5003, 1042, "SSD NVMe 3.84TB", "Micron", "7450 PRO", "U.3", "NVME-3840-5003", "DC-QC-CMP-005003", 980.00), _piece(5004, 1042, "Châssis + carte mère R760", "Dell", "PowerEdge R760 Base", "2U", "CHS-R760-5004", "DC-QC-CMP-005004", 23436.05), # ---------------- PARENT 2 : Serveur HPE ---------------- { "id": 1055, "path": "parent_1055", "type": "parent", "name": "Serveur HPE ProLiant DL380 Gen11", "parent_id": None, "view_admin": { "serial_number": "SGH-2026-DL380-0055", "inventory_tag": "DC-QC-SRV-001055", "manufacturer": "HPE", "model": "ProLiant DL380 Gen11", "form_factor": "2U Rackmount", "canvas": {"x": 0, "y": 0, "width": 260, "height": 150, "z_index": 0}, "operational_status": "Actif", }, "view_cpa": { "original_cost": {"amount": 0, "currency": "CAD"}, "exchange_rate_applied": 1.0, "exchange_rate_date": "2026-03-05", "cost_pre_tax_cad": 0, "non_recoverable_taxes_and_duties": 0.0, "capitalizable_base_cad": 0, "cca_class": {"id": 50, "description": "Matériel informatique", "dpa_rate": 0.55}, "acquisition_date": "2026-03-05", "in_service_date": "2026-03-10", "half_year_rule_applies": True, }, "view_auditor": { "supplier": "HPE Canada", "invoice_pdf_file_id": "inv_hpe_dl380_0055", "invoice_number": "HPE-CA-2026-0123", "audit_trail": [ {"action": "CREATED", "description": "Immobilisation créée", "timestamp": "2026-03-05T11:00:00-05:00"}, ], }, }, _piece(5005, 1055, "Châssis + carte mère DL380", "HPE", "DL380 Gen11 Base", "2U", "CHS-DL380-5005", "DC-QC-CMP-005005", 14800.00), _piece(5006, 1055, "RAM DDR5 32GB - Slot 1", "Kingston", "KSM48E40BS8KI", "DIMM", "MEM-DDR5-32-5006", "DC-QC-CMP-005006", 700.00), # ---------------- PIÈCE LIBRE (non rattachée) ---------------- _piece(5007, None, "SSD NVMe 1.92TB (en stock)", "Samsung", "PM9A3", "U.2", "NVME-1920-5007", "DC-QC-CMP-005007", 540.00, status="Stock"), ] def _piece(pid, parent_id, name, manuf, model, form, serial, tag, cost, status="Actif"): path = f"parent_{parent_id}.piece_{pid}" if parent_id else f"libre_{pid}" return { "id": pid, "path": path, "type": "piece", "name": name, "parent_id": parent_id, "view_admin": { "serial_number": serial, "inventory_tag": tag, "manufacturer": manuf, "model": model, "form_factor": form, "canvas": {"x": 0, "y": 0, "width": 200, "height": 60, "z_index": 0}, "operational_status": status, }, "view_cpa": { "original_cost": {"amount": cost, "currency": "CAD"}, "exchange_rate_applied": 1.0, "exchange_rate_date": "2026-02-11", "cost_pre_tax_cad": cost, "non_recoverable_taxes_and_duties": 0.0, "capitalizable_base_cad": cost, "cca_class": {"id": 50, "description": "Matériel informatique", "dpa_rate": 0.55}, "acquisition_date": "2026-02-11", "in_service_date": "2026-02-20", "half_year_rule_applies": True, }, "view_auditor": { "supplier": manuf, "invoice_pdf_file_id": f"inv_piece_{pid}", "invoice_number": f"INV-2026-{pid}", "audit_trail": [ {"action": "CREATED", "description": "Pièce créée", "timestamp": "2026-02-11T14:35:00-05:00"} ], }, }