use crate::consts::DEFAULT_INVITE_HOURS;
use clap::{Args, Subcommand};

#[derive(Debug, Args)]
#[command(args_conflicts_with_subcommands = true)]
#[command(about = "Manage Ringspace invites")]
#[command(flatten_help = true)]
pub struct InviteArgs {
    #[command(subcommand)]
    pub command: Option<InviteCommands>,
}

#[derive(Debug, Subcommand)]
pub enum InviteCommands {
    #[command(about = "Create a new invitation", alias = "add")]
    Create {
        #[arg(help = "Member URL", short = 'u', long = "url", required = true)]
        url: String,

        #[arg(
            help = "Hours until code expires",
            short = 'e',
            long = "expiration-hrs",
            default_value_t = DEFAULT_INVITE_HOURS,
            required = false
        )]
        expiration_hours: i64,

        #[arg(help = "Ring URL", short = 'r', long = "ring-url", required = false)]
        ring_url: Option<String>,
    },

    #[command(about = "List invitations")]
    List,

    #[command(about = "Revoke invitation by ID", alias = "delete")]
    Revoke {
        #[arg(help = "Invitation ID", short = 'i', long = "id", required = true)]
        invite_id: i64,

        #[arg(help = "Confirm", short = 'y', long = "confirm", required = false)]
        confirm: Option<bool>,
    },
}
