package cloud.nstart.terravault.ordinis.events.record;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;

/**
 * Sealed interface для всех событий по записям справочника. Jackson
 * polymorphic deserialization через {@code "type"} discriminator.
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
@JsonSubTypes({
    @JsonSubTypes.Type(value = DictionaryRecordCreated.class, name = "RecordCreated"),
    @JsonSubTypes.Type(value = DictionaryRecordUpdated.class, name = "RecordUpdated"),
    @JsonSubTypes.Type(value = DictionaryRecordDeleted.class, name = "RecordDeleted")
})
public sealed interface DictionaryRecordEvent
    permits DictionaryRecordCreated, DictionaryRecordUpdated, DictionaryRecordDeleted {

  /** UUID dictionary_records.id. */
  java.util.UUID recordId();

  /** Бизнес-ключ записи (стабильный across versions). */
  String businessKey();
}
