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

import cloud.nstart.terravault.ordinis.events.DataScope;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.JsonNode;

import java.time.OffsetDateTime;
import java.util.List;
import java.util.UUID;

/**
 * Изменение определения справочника (schema, supported_locales и т.д.). Вместе
 * с новой версией прилетает {@code previousSchemaJson} для diff.
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public record DictionaryDefinitionUpdated(
    UUID definitionId,
    String dictionaryName,
    String displayName,
    String description,
    DataScope scope,
    JsonNode schemaJson,
    JsonNode previousSchemaJson,
    String schemaVersion,
    String bundle,
    List<String> supportedLocales,
    String defaultLocale,
    OffsetDateTime updatedAt,
    String updatedBy) implements DictionaryDefinitionEvent {

  @com.fasterxml.jackson.annotation.JsonProperty("type")
  public String type() { return "DefinitionUpdated"; }
}
