made_core/value_objects/
council_journal_lease.rs1use super::{CouncilJournalConsumer, CouncilJournalLeaseId, CouncilJournalPosition};
2use serde::{Deserialize, Serialize};
3use time::OffsetDateTime;
4
5#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7pub struct CouncilJournalLease {
8 consumer: CouncilJournalConsumer,
9 id: CouncilJournalLeaseId,
10 acknowledged_through: Option<CouncilJournalPosition>,
11 #[serde(with = "time::serde::rfc3339")]
12 expires_at: OffsetDateTime,
13}
14impl CouncilJournalLease {
15 #[must_use]
16 pub fn new(
17 consumer: CouncilJournalConsumer,
18 id: CouncilJournalLeaseId,
19 acknowledged_through: Option<CouncilJournalPosition>,
20 expires_at: OffsetDateTime,
21 ) -> Self {
22 Self {
23 consumer,
24 id,
25 acknowledged_through,
26 expires_at,
27 }
28 }
29 #[must_use]
30 pub fn consumer(&self) -> &CouncilJournalConsumer {
31 &self.consumer
32 }
33 #[must_use]
34 pub fn id(&self) -> &CouncilJournalLeaseId {
35 &self.id
36 }
37 #[must_use]
38 pub fn acknowledged_through(&self) -> Option<CouncilJournalPosition> {
39 self.acknowledged_through
40 }
41 #[must_use]
42 pub fn expires_at(&self) -> OffsetDateTime {
43 self.expires_at
44 }
45}