use clap::{Parser, ValueEnum};

#[derive(Clone, Debug, ValueEnum)]
pub enum FillMergedCells {
    None,
    Horizontal,
    Vertical,
    Both
}

impl ToString for FillMergedCells {
    fn to_string(&self) -> String {
        match self {
            FillMergedCells::None => "none".into(),
            FillMergedCells::Horizontal => "horizontal".into(),
            FillMergedCells::Vertical => "vertical".into(),
            FillMergedCells::Both => "both".into(),
        }
    }
}

#[derive(Clone, Debug, ValueEnum)]
pub enum TrimSpaces {
    End,
    Start,
    Both,
    None
}

impl ToString for TrimSpaces {
    fn to_string(&self) -> String {
        match self {
            TrimSpaces::End => "end".into(),
            TrimSpaces::Start => "start".into(),
            TrimSpaces::Both => "both".into(),
            TrimSpaces::None => "none".into(),
        }
    }
}


#[derive(Parser, Debug)]
pub struct Arguments {
    /// Path to the xlsx file
    #[arg()]
    pub file: String,
    /// Separator
    #[arg(short, long, default_value_t = ';')]
    pub separator: char,
    /// Replace separator char in cells by
    #[arg(short, long)]
    pub replace_separator_by: Option<String>,
    /// include hidden lines to output
    #[arg(short, long, default_value_t=false)]
    pub include_hidden_lines: bool,
    /// If merged cells, fill horizontally, vertically, both, or none
    #[arg(short, long, default_value_t = FillMergedCells::None)]
    pub fill_merged_cells: FillMergedCells,
    /// Chosse worksheet
    #[arg(short, long, default_value_t = String::from("0"))]
    pub worksheet: String,
    /// Trim white spaces at end of cells
    #[arg(short, long, default_value_t = TrimSpaces::None)]
    pub trim: TrimSpaces,
}
