use core::ops::Deref;
use bee_block::{output::Output, payload::milestone::MilestoneIndex, protocol::ProtocolParameters, BlockId};
use crate::error::Error;
#[derive(Clone, Debug, Eq, PartialEq, packable::Packable)]
#[packable(unpack_error = Error)]
#[packable(unpack_visitor = ProtocolParameters)]
pub struct CreatedOutput {
block_id: BlockId,
milestone_index: MilestoneIndex,
milestone_timestamp: u32,
inner: Output,
}
impl CreatedOutput {
pub fn new(block_id: BlockId, milestone_index: MilestoneIndex, milestone_timestamp: u32, inner: Output) -> Self {
Self {
block_id,
milestone_index,
milestone_timestamp,
inner,
}
}
pub fn block_id(&self) -> &BlockId {
&self.block_id
}
pub fn milestone_index(&self) -> MilestoneIndex {
self.milestone_index
}
pub fn milestone_timestamp(&self) -> u32 {
self.milestone_timestamp
}
pub fn inner(&self) -> &Output {
&self.inner
}
}
impl Deref for CreatedOutput {
type Target = Output;
fn deref(&self) -> &Self::Target {
&self.inner
}
}