use crate::event::{EventId, Kind};
use crate::key::PublicKey;
use crate::types::RelayUrl;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Nip19Event {
pub event_id: EventId,
pub author: Option<PublicKey>,
pub kind: Option<Kind>,
pub relays: Vec<RelayUrl>,
}
impl Nip19Event {
#[must_use]
pub const fn new(event_id: EventId) -> Self {
Self {
event_id,
author: None,
kind: None,
relays: Vec::new(),
}
}
#[must_use]
pub const fn with_author(mut self, author: PublicKey) -> Self {
self.author = Some(author);
self
}
#[must_use]
pub const fn with_kind(mut self, kind: Kind) -> Self {
self.kind = Some(kind);
self
}
#[must_use]
pub fn with_relays(mut self, relays: impl IntoIterator<Item = RelayUrl>) -> Self {
self.relays.extend(relays);
self
}
}