import { createService, updateService, deleteService, createCategorie, updateCategorie, deleteCategorie, createContact, updateContact, deleteContact, createMonitoring, updateMonitoring, desactiverMonitoring, } from '../../services/api'; /* Description déclarative des 4 référentiels administrables. Les colonnes du tableau, les champs du formulaire et les appels API sont décrits ici plutôt que répétés onglet par onglet : les 4 onglets partagent ainsi un seul tableau et un seul formulaire. */ export const REFERENTIELS = [ { key: 'monitorings', label: 'Monitorings', singulier: 'monitoring', idField: 'id_monito', /* Désactivation logique : TABLE_FINAL référence le monitoring. */ suppressionEstDesactivation: true, colonnes: [ { key: 'monito_intitule', label: 'Nom' }, { key: 'id_service', label: 'Service', referentiel: 'services' }, { key: 'id_categorie', label: 'Catégorie', referentiel: 'categories' }, { key: 'bdd_source', label: 'Source' }, { key: 'table_source', label: 'Table' }, ], champs: [ { name: 'monito_intitule', label: 'Nom', type: 'text', required: true }, { name: 'id_service', label: 'Service', type: 'select', options: 'services', required: true }, { name: 'id_categorie', label: 'Catégorie', type: 'select', options: 'categories', required: true }, { name: 'table_source', label: 'Table source', type: 'text', required: true }, { name: 'bdd_source', label: 'Base source', type: 'text', required: true }, ], creer: createMonitoring, modifier: updateMonitoring, supprimer: desactiverMonitoring, }, { key: 'services', label: 'Services', singulier: 'service', idField: 'id_service', colonnes: [{ key: 'nom_service', label: 'Nom' }], champs: [{ name: 'nom_service', label: 'Nom du service', type: 'text', required: true }], creer: createService, modifier: updateService, supprimer: deleteService, }, { key: 'categories', label: 'Catégories', singulier: 'catégorie', idField: 'id_categorie', colonnes: [{ key: 'intitule_categorie', label: 'Nom' }], champs: [{ name: 'intitule_categorie', label: 'Intitulé', type: 'text', required: true }], creer: createCategorie, modifier: updateCategorie, supprimer: deleteCategorie, }, { key: 'contacts', label: 'Contacts', singulier: 'contact', idField: 'id_contact', colonnes: [ { key: 'intitule_contact', label: 'Intitulé' }, { key: 'nom', label: 'Nom' }, { key: 'prenom', label: 'Prénom' }, { key: 'mail', label: 'Email' }, { key: 'id_service', label: 'Service', referentiel: 'services' }, ], champs: [ { name: 'intitule_contact', label: 'Intitulé', type: 'text', required: true }, { name: 'nom', label: 'Nom', type: 'text', required: true }, { name: 'prenom', label: 'Prénom', type: 'text', required: true }, { name: 'mail', label: 'Email', type: 'email', required: true }, { name: 'id_service', label: 'Service', type: 'select', options: 'services', required: true }, ], creer: createContact, modifier: updateContact, supprimer: deleteContact, }, ]; /* Libellés des listes déroulantes et des colonnes qui affichent un identifiant. */ export const LIBELLES_REFERENTIEL = { services: { idField: 'id_service', labelField: 'nom_service' }, categories: { idField: 'id_categorie', labelField: 'intitule_categorie' }, };