use schemars::JsonSchema;
use serde::Deserialize;

use crate::plugins::auth_enforcement::auth_result::AuthResultConfiguration;

#[derive(Clone, Debug, Deserialize, JsonSchema)]
pub struct HMACRuleConfiguration {
    pub hmac_use: AuthResultConfiguration,
    pub recipient_mismatch: AuthResultConfiguration,
}

#[cfg(test)]
mod test {
    use super::*;

    impl HMACRuleConfiguration {
        pub fn all_ok() -> HMACRuleConfiguration {
            HMACRuleConfiguration {
                hmac_use: AuthResultConfiguration::Ok,
                recipient_mismatch: AuthResultConfiguration::Ok,
            }
        }

        pub fn all_warning() -> HMACRuleConfiguration {
            HMACRuleConfiguration {
                hmac_use: AuthResultConfiguration::Warning,
                recipient_mismatch: AuthResultConfiguration::Warning,
            }
        }

        pub fn all_block() -> HMACRuleConfiguration {
            HMACRuleConfiguration {
                hmac_use: AuthResultConfiguration::Block,
                recipient_mismatch: AuthResultConfiguration::Block,
            }
        }
    }
}
