<?php

declare(strict_types=1);

namespace App\Framework\Database\Migration;

/**
 * Interface for migrations that have dependencies on other migrations.
 *
 * This extends the base Migration interface to add dependency tracking.
 * Migrations that implement this interface can specify other migrations
 * that must be applied before this one.
 */
interface DependentMigration extends Migration
{
    /**
     * Get the versions of migrations that this migration depends on.
     *
     * These migrations must be applied before this one.
     *
     * @return MigrationVersionCollection Collection of migration versions that this migration depends on
     */
    public function getDependencies(): MigrationVersionCollection;

    /**
     * Check if this migration depends on another migration.
     *
     * @param MigrationVersion $version The version to check
     * @return bool True if this migration depends on the specified version
     */
    public function dependsOn(MigrationVersion $version): bool;

    /**
     * Add a dependency to this migration.
     *
     * @param MigrationVersion $version The version to depend on
     * @return self
     */
    public function addDependency(MigrationVersion $version): self;
}
