pulse-pixelstream-types 0.14.1

Shared Myko entity and command types for the Pulse Pixelstream recording cell.
Documentation
use myko::entities::client::{Client, ClientId};
use myko::prelude::*;
use myko_macros::myko_item;

use crate::stream::{Stream, StreamId};

/// Ephemeral single-holder control lock per stream. SET overwrites (takeover);
/// cascade-deleted on holder disconnect (auto-release). One row per stream.
#[myko_item]
pub struct ControlLock {
    #[belongs_to(Stream)]
    pub stream_id: StreamId,
    pub viewer_id: String,
    #[myko_client_id]
    #[belongs_to(Client)]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub client_id: Option<ClientId>,
}

impl ControlLock {
    pub fn row_id(stream_id: &StreamId) -> ControlLockId {
        stream_id.0.to_string().into()
    }
}