<?xml version="1.0" encoding="UTF-8"?>
<!--
  error-event-publisher — durable cross-service error-event stream (ADR-0015).

  Public API:
    - ErrorEventPublisher           best-effort facade: publish(ErrorEvent), never throws
    - ErrorEventOutboxWriter        @Transactional(REQUIRES_NEW) outbox write (survives a
                                    rolling-back business tx — the ADR-0015 D-3 hazard)
    - ErrorEventProperties          im2be.error-event.* config
    - ErrorEventAutoConfiguration   autoconfig, @ConditionalOnProperty(enabled)

  Serializes observability.v1.ErrorEvent (proto-observability) as RAW protobuf bytes
  (ADR-0015 D-2 — no Apicurio; registry-outage resilience) and publishes to
  im2be.error.event via the ADR-0014 outbox. Enable per service:
    im2be.error-event.enabled=true
  Default OFF. Per ADR-0015 (#332 error-event Kafka stream); consumed by
  OtelErrorEvents.record(...) so one catch-site call emits span-event + counter +
  durable Kafka event.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.aim2be</groupId>
        <artifactId>im2be-platform-libs-parent</artifactId>
        <version>1.1.0-SNAPSHOT</version>
    </parent>

    <artifactId>error-event-publisher</artifactId>
    <packaging>jar</packaging>
    <name>im2be-platform-libs :: error-event-publisher</name>
    <description>Durable cross-service error-event Kafka stream via the outbox (ADR-0015).</description>

    <properties>
        <!-- proto-observability is a FIXED release (immutable contract), NOT a
             SNAPSHOT — the ErrorEvent wire schema is stable. Pinned per rule 9. -->
        <proto-observability.version>1.0.0</proto-observability.version>
    </properties>

    <dependencies>
        <!-- Reuses the ADR-0014 outbox (OutboxPublisher) — same platform version. -->
        <dependency>
            <groupId>com.aim2be</groupId>
            <artifactId>outbox-publisher</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!-- The ErrorEvent wire contract (generated proto types + protobuf-java). -->
        <dependency>
            <groupId>com.aim2be</groupId>
            <artifactId>proto-observability</artifactId>
            <version>${proto-observability.version}</version>
        </dependency>
        <!-- @AutoConfiguration / @ConditionalOnProperty / @ConfigurationProperties. -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>
        <!-- @Transactional(propagation = REQUIRES_NEW) (ADR-0015 D-3). Declared
             directly (rule 9) though also transitive via outbox-publisher's JPA. -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
        </dependency>
        <!-- @Validated + @NotBlank on ErrorEventProperties.topic — a blank topic
             misconfiguration fails fast at startup, not silently at publish time. -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>

        <!-- Self-test. -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- Test-only: mocking OutboxPublisher runs its static initializer, which
             references OTel AttributeKey. outbox-publisher declares opentelemetry-api
             as `provided` (consuming services bring it at runtime), so it is NOT on
             this module's test classpath unless declared here. -->
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-api</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
