use super::Ex3Uint;
use crate::impl_compare_unit_for;
use candid::Nat;
use num_bigint::BigUint;

impl_compare_unit_for!(Ex3Uint, u8, u16, u32, u64, u128, usize);

impl PartialEq<BigUint> for Ex3Uint {
    fn eq(&self, other: &BigUint) -> bool {
        self.0 == *other
    }
}

impl PartialOrd<BigUint> for Ex3Uint {
    fn partial_cmp(&self, other: &BigUint) -> Option<std::cmp::Ordering> {
        self.0.partial_cmp(other)
    }
}

impl PartialEq<Ex3Uint> for BigUint {
    fn eq(&self, other: &Ex3Uint) -> bool {
        *self == other.0
    }
}

impl PartialOrd<Ex3Uint> for BigUint {
    fn partial_cmp(&self, other: &Ex3Uint) -> Option<std::cmp::Ordering> {
        self.partial_cmp(&other.0)
    }
}

impl PartialEq<Nat> for Ex3Uint {
    fn eq(&self, other: &Nat) -> bool {
        self.0 == other.0
    }
}

impl PartialOrd<Nat> for Ex3Uint {
    fn partial_cmp(&self, other: &Nat) -> Option<std::cmp::Ordering> {
        self.0.partial_cmp(&other.0)
    }
}

impl PartialEq<Ex3Uint> for Nat {
    fn eq(&self, other: &Ex3Uint) -> bool {
        self.0 == other.0
    }
}

impl PartialOrd<Ex3Uint> for Nat {
    fn partial_cmp(&self, other: &Ex3Uint) -> Option<std::cmp::Ordering> {
        self.0.partial_cmp(&other.0)
    }
}
