use std::collections::BTreeMap;
use ruma_common::{OwnedServerName, SigningKeyAlgorithm, serde::Base64};
use ruma_macros::EventContent;
use serde::{Deserialize, Serialize};
use crate::EmptyStateKey;
pub const POLICY_SERVER_ED25519_SIGNING_KEY_ID: &str = "ed25519:policy_server";
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
#[ruma_event(type = "m.room.policy", kind = State, state_key_type = EmptyStateKey)]
pub struct RoomPolicyEventContent {
pub via: OwnedServerName,
pub public_keys: BTreeMap<SigningKeyAlgorithm, Base64>,
}
impl RoomPolicyEventContent {
pub fn new(via: OwnedServerName, ed25519_public_key: Base64) -> Self {
Self { via, public_keys: [(SigningKeyAlgorithm::Ed25519, ed25519_public_key)].into() }
}
}