/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2026 metamuffin <metamuffin.org>
*/
use clap::{Parser, ValueEnum};
use std::path::PathBuf;

pub type Args = Action;

#[derive(Parser)]
#[clap(version, about)]
/// Tool for administering a Jellything instance
pub enum Action {
    /// Interactive wizard for renaming files
    Add {
        /// Path to the media of this node.
        media: PathBuf,
    },
    /// Migrate the database by export or import to JSON
    Migrate {
        /// Database path as specified in the configuration
        database: PathBuf,
        /// Whether to import or export
        mode: MigrateMode,
        /// Location of the database in its exported form
        save_location: PathBuf,
    },
    /// Issue a reimport via the API
    Reimport {
        /// Custom hostname, the config's is used by default
        #[arg(long)]
        hostname: Option<String>,
        /// Disable TLS. Dont use this.
        #[arg(long)]
        no_tls: bool,
        /// Perform full import
        #[arg(long)]
        no_incremental: bool,
    },
}

#[derive(Debug, Clone, Copy, PartialEq, ValueEnum)]
pub enum MigrateMode {
    /// Import from JSON
    Import,
    /// Export to JSON
    Export,
}
