use codec::{Encode, Decode};
use scale_info::TypeInfo;
use sp_runtime::RuntimeDebug;

use frame_support::{BoundedVec, traits::ConstU32};

use crate::{ExodusHash, ELEMENT_MAX_BYTES};

#[derive(Default, Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
pub struct ConsensusState<Bitmap> {
    pub element_bytes: BoundedVec<u8, ConstU32<ELEMENT_MAX_BYTES>>,
    pub participants: Bitmap,
    pub merkle_root: ExodusHash,
}

impl<Bitmap> ConsensusState<Bitmap> {
    pub fn new(
        element_bytes: BoundedVec<u8, ConstU32<ELEMENT_MAX_BYTES>>,
        participants: Bitmap,
        merkle_root: ExodusHash,
    ) -> Self {
        Self { element_bytes, participants, merkle_root }
    }
}
