labfy-investigation/include/core/eml_integration.h
2026-07-28 08:53:31 +02:00

55 lines
2.3 KiB
C

/******************************************************************************
* @file eml_integration.h
* @brief Intégration transactionnelle de propositions issues d'un EML.
******************************************************************************/
#ifndef LABFY_INVESTIGATION_EML_INTEGRATION_H
#define LABFY_INVESTIGATION_EML_INTEGRATION_H
#include "database/database.h"
#include <glib.h>
G_BEGIN_DECLS
/** @brief Proposition d'entité explicitement sélectionnable. */
typedef struct {
char *type_identifier;
char *value;
char *verification_status;
char *provenance_kind;
char *value_raw;
char *role;
char *source_header;
guint occurrence;
gboolean promote_to_entity;
} EmlEntityProposal;
/** @brief Crée une proposition possédée. */
EmlEntityProposal *eml_entity_proposal_new(const char *type_identifier,
const char *value);
EmlEntityProposal *eml_entity_proposal_new_with_metadata(
const char *type_identifier, const char *value,
const char *verification_status, const char *provenance_kind);
EmlEntityProposal *eml_entity_proposal_new_observation(
const char *type_identifier, const char *value_raw,
const char *value_normalized, const char *role,
const char *source_header, guint occurrence,
const char *verification_status, const char *provenance_kind);
/** @brief Libère une proposition. */
void eml_entity_proposal_free(EmlEntityProposal *proposal);
/**
* @brief Intègre atomiquement des entités et les lie à la preuve EML.
* @param database Connexion ouverte empruntée.
* @param evidence_identifier UUID de la preuve source.
* @param proposals Tableau de EmlEntityProposal sélectionnées.
* @param out_created Nombre d'entités créées.
* @param out_reused Nombre d'entités existantes réutilisées.
* @param error Destination facultative d'une erreur.
* @return TRUE après validation de la transaction.
*/
gboolean eml_integration_apply(Database *database,
const char *evidence_identifier, const GPtrArray *proposals,
guint *out_observations, guint *out_created, guint *out_reused,
GError **error);
/** @brief Annule une promotion sans supprimer l'observation. */
gboolean eml_integration_remove_promotion(Database *database,
const char *observation_identifier, gboolean *out_entity_deleted,
gboolean *out_entity_shared, GError **error);
G_END_DECLS
#endif