// <auto-generated />
// This file is auto-generated from core/vault/src/sql/VaultVersions.ts
// Do not edit this file directly. Run './build.sh' in core/vault to regenerate.
@file:Suppress("all")

package net.aliasvault.app.vaultstore.models

/**
 * Vault database version information.
 */
data class VaultVersion(
    /** The migration revision number. */
    val revision: Int,
    /** The internal migration version number that equals the AliasClientDb database version (e.g., "1.5.0"). */
    val version: String,
    /** Description of changes in this version. */
    val description: String,
    /** The AliasVault release that this vault version was introduced in (e.g., "0.14.0"). */
    val releaseVersion: String,
    /** The last AliasVault release version that the vault was compatible with before requiring this migration. */
    val compatibleUpToVersion: String,
)

/**
 * Registry of all vault versions.
 */
object VaultVersions {
    /**
     * All vault migrations/versions in chronological order.
     */
    val all: List<VaultVersion> = listOf(
        VaultVersion(
            revision = 1,
            version = "1.0.0",
            description = "Initial Migration",
            releaseVersion = "0.1.0",
            compatibleUpToVersion = "0.0.0",
        ),
        VaultVersion(
            revision = 2,
            version = "1.0.1",
            description = "Empty Test Migration",
            releaseVersion = "0.2.0",
            compatibleUpToVersion = "0.1.0",
        ),
        VaultVersion(
            revision = 3,
            version = "1.0.2",
            description = "Change Email Column",
            releaseVersion = "0.3.0",
            compatibleUpToVersion = "0.2.0",
        ),
        VaultVersion(
            revision = 4,
            version = "1.1.0",
            description = "Add Pki Tables",
            releaseVersion = "0.4.0",
            compatibleUpToVersion = "0.3.0",
        ),
        VaultVersion(
            revision = 5,
            version = "1.2.0",
            description = "Add Settings Table",
            releaseVersion = "0.4.0",
            compatibleUpToVersion = "0.3.0",
        ),
        VaultVersion(
            revision = 6,
            version = "1.3.0",
            description = "Update Identity Structure",
            releaseVersion = "0.5.0",
            compatibleUpToVersion = "0.4.0",
        ),
        VaultVersion(
            revision = 7,
            version = "1.3.1",
            description = "Make Username Optional",
            releaseVersion = "0.5.0",
            compatibleUpToVersion = "0.4.0",
        ),
        VaultVersion(
            revision = 8,
            version = "1.4.0",
            description = "Add Sync Support",
            releaseVersion = "0.6.0",
            compatibleUpToVersion = "0.5.0",
        ),
        VaultVersion(
            revision = 9,
            version = "1.4.1",
            description = "Rename Attachments Plural",
            releaseVersion = "0.6.0",
            compatibleUpToVersion = "0.13.0",
        ),
        VaultVersion(
            revision = 10,
            version = "1.5.0",
            description = "Add 2FA Tokens to credentials",
            releaseVersion = "0.14.0",
            compatibleUpToVersion = "0.23.0",
        ),
        VaultVersion(
            revision = 11,
            version = "1.6.0",
            description = "Add Passkey support",
            releaseVersion = "0.24.0",
            compatibleUpToVersion = "0.25.0",
        ),
        VaultVersion(
            revision = 12,
            version = "1.7.0",
            description = "Update to Field-Based Data Model",
            releaseVersion = "0.26.0",
            compatibleUpToVersion = "0.25.0",
        ),
        VaultVersion(
            revision = 13,
            version = "2.0.0",
            description = "Update to Field-Based Data Model",
            releaseVersion = "0.26.1",
            compatibleUpToVersion = "0.25.0",
        ),
    )

    /**
     * Get the latest vault version.
     */
    val latest: VaultVersion
        get() = all.last()

    /**
     * Get the latest vault version string (e.g., "1.7.0").
     */
    val latestVersion: String
        get() = latest.version

    /**
     * Get the latest vault revision number.
     */
    val latestRevision: Int
        get() = latest.revision

    /**
     * Find a vault version by revision number.
     */
    fun findByRevision(revision: Int): VaultVersion? {
        return all.find { it.revision == revision }
    }

    /**
     * Find a vault version by version string.
     */
    fun findByVersion(version: String): VaultVersion? {
        return all.find { it.version == version }
    }
}
