mod decoding_write_ins;
mod write_ins_tally_phase;
use super::ElectoralModelError;
use rust_ev_crypto_primitives::{Integer, ModExponentiateError};
use thiserror::Error;
pub use write_ins_tally_phase::decode_write_ins;
#[derive(Error, Debug)]
#[error(transparent)]
pub struct WriteInsError(#[from] WriteInsErrorRepr);
#[derive(Error, Debug)]
enum WriteInsErrorRepr {
#[error("Error input in decode_write_ins: {0}")]
DecodeWriteInsInput(String),
#[error("Error getting psi")]
ElectoralModelError(#[from] ElectoralModelError),
#[error("Error calculating quadratic to write-in")]
QuadraticToWriteIns { source: ModExponentiateError },
#[error("Error calculating quadratic to write-in for {val}")]
QuadraticToWriteInsForVal {
val: Integer,
source: Box<WriteInsError>,
},
#[error("x cannot be less or equal 0")]
XPositive,
}