package com.gzzn.omms.msgexchange.processing import com.gzzn.omms.msgexchange.config.PipelineProps import com.gzzn.omms.msgexchange.domain.DecodedMessage import java.time.LocalDate /** * ACMA-8 I3:幂等键 = SNDR|TYPE|STYP|SEQN。 * 计算集中此处唯一入口;“是否含日边界”可配置且默认关闭(CONFIRM 矩阵 #11, * SEQN 重置作用域确认前不改语义——上线后不改幂等键)。 */ object Identity { fun of( msg: DecodedMessage, includeDayBoundary: Boolean, day: LocalDate = LocalDate.now(), ): String { val base = "${msg.meta.sndr}|${msg.meta.type}|${msg.meta.styp}|${msg.meta.seqn}" return if (includeDayBoundary) "$base|${day}" else base } fun of(msg: DecodedMessage, props: PipelineProps.Identity): String = of(msg, props.includeDayBoundary) }