package de.effigenix.shared.common;

/**
 * Repository operation errors.
 * Shared Kernel — used by all Bounded Contexts.
 * Sealed interface ensures exhaustive handling.
 */
public sealed interface RepositoryError {

    String message();

    record EntityNotFound(String entityType, String id) implements RepositoryError {
        @Override
        public String message() {
            return entityType + " with ID '" + id + "' not found";
        }
    }

    record DuplicateEntry(String message) implements RepositoryError {
    }

    record DatabaseError(String message) implements RepositoryError {
    }

    record ConcurrentModification(String message) implements RepositoryError {
    }
}
