package com.livingworld.data.migration;

import java.util.Properties;

/**
 * A single schema migration step for region save data.
 *
 * <p>Each migration advances exactly one schema version. Implementations must be
 * deterministic: given the same input {@link Properties}, they must always produce
 * the same output. The {@link MigrationManager} updates {@code schemaVersion} in the
 * result automatically; implementations must not set it themselves.
 */
public interface RegionMigration {

    /** The schema version this migration reads from. */
    int fromVersion();

    /**
     * The schema version this migration produces.
     *
     * <p>Must equal {@link #fromVersion()} + 1.
     */
    int toVersion();

    /**
     * Applies this migration to the given save data.
     *
     * @param data a copy of the raw region save properties at {@link #fromVersion()}
     * @return a new or mutated {@link Properties} containing the migrated data
     */
    Properties apply(Properties data);
}
