package de.gecheckt.pdf.umbenenner.bootstrap;

import java.util.Objects;

import de.gecheckt.pdf.umbenenner.application.config.startup.StartConfiguration;

/**
 * Immutable context built once at GUI startup for a specific validated configuration file.
 * <p>
 * Holds the fully validated {@link StartConfiguration} and the resolved JDBC URL for the
 * active SQLite database. This context is created after a successful migrate → load →
 * validate → schema-init sequence and is reused for all subsequent batch runs and
 * database operations without repeating those steps.
 * <p>
 * When the configuration changes (e.g., the user opens a different file), a new context
 * must be built. Structural configuration changes require a GUI restart to take effect.
 * <p>
 * Thread-safety: this record is immutable and safe for concurrent access.
 */
record ApplicationRunContext(StartConfiguration startConfiguration, String jdbcUrl) {

    ApplicationRunContext {
        Objects.requireNonNull(startConfiguration, "startConfiguration must not be null");
        Objects.requireNonNull(jdbcUrl, "jdbcUrl must not be null");
    }
}
