use crate::commands::constants::*;
use crate::TmuxCommand;
use std::borrow::Cow;
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default)]
pub struct WaitFor<'a> {
    #[cfg(feature = "tmux_1_8")]
    pub locked: bool,
    #[cfg(feature = "tmux_1_8")]
    pub woken: bool,
    #[cfg(feature = "tmux_1_8")]
    pub unlocked: bool,
    #[cfg(feature = "tmux_1_8")]
    pub channel: Option<Cow<'a, str>>,
}
impl<'a> WaitFor<'a> {
    pub fn new() -> Self {
        Default::default()
    }
    #[cfg(feature = "tmux_1_8")]
    pub fn locked(mut self) -> Self {
        self.locked = true;
        self
    }
    #[cfg(feature = "tmux_1_8")]
    pub fn woken(mut self) -> Self {
        self.woken = true;
        self
    }
    #[cfg(feature = "tmux_1_8")]
    pub fn unlocked(mut self) -> Self {
        self.unlocked = true;
        self
    }
    #[cfg(feature = "tmux_1_8")]
    pub fn channel<S: Into<Cow<'a, str>>>(mut self, channel: S) -> Self {
        self.channel = Some(channel.into());
        self
    }
    pub fn build(self) -> TmuxCommand<'a> {
        let mut cmd = TmuxCommand::new();
        cmd.name(WAIT_FOR);
        #[cfg(feature = "tmux_1_8")]
        if self.locked {
            cmd.push_flag(L_UPPERCASE_KEY);
        }
        #[cfg(feature = "tmux_1_8")]
        if self.woken {
            cmd.push_flag(S_UPPERCASE_KEY);
        }
        #[cfg(feature = "tmux_1_8")]
        if self.unlocked {
            cmd.push_flag(U_UPPERCASE_KEY);
        }
        #[cfg(feature = "tmux_1_8")]
        if let Some(channel) = self.channel {
            cmd.push_param(channel);
        }
        cmd
    }
}