1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use crate::rules::validation::Validation;
use crate::utils::Error;
use macros::Rule;

/// Verifies if exists conflicting ongoing voting. May return [Error::VotingNotCompleted].
#[derive(Rule)]
pub struct ExistsOngoingVoting {
    is_ongoing_voting: bool,
}

impl Validation for ExistsOngoingVoting {
    fn validate(&self) -> Result<(), Error> {
        if self.is_ongoing_voting {
            return Err(Error::VotingNotCompleted);
        };

        Ok(())
    }
}