using Invercargill; using Invercargill.Mapping; namespace Statum.Model { /** * A Statum slot. * * A slot is an addressable container for a single snapshot. Its `key` is a * server-issued identifier used on the wire (in headers and directives), * its `scope` controls client-side persistence, and its `slot_type` is an * application-defined name under which the frontend exposes the slot's * current {@link SnapshotDto.public} data. * * Statum assumes at most one slot per type on the client. */ public class SlotDto : Object { /** Server-issued identifier for the slot. */ public string key { get; set; } /** Client-side persistence scope for the slot. */ public Scope scope { get; set; } /** * Application-defined type name for the slot. * * Named `slot_type` (rather than `type`) because GObject reserves a * property named `type`; the JSON key remains `type` via the mapper. */ public string slot_type { get; set; } /** * The {@link PropertyMapper} used to (de)serialise a {@link SlotDto} * to/from a {@link Invercargill.Properties} object (and therefore * JSON via Invercargill-Json). */ public static PropertyMapper get_mapper() { return PropertyMapper.build_for(cfg => { cfg.map("key", o => o.key, (o, v) => o.key = v); cfg.map("scope", o => o.scope.to_string(), (o, v) => o.scope = Scope.parse(v)); cfg.map("type", o => o.slot_type, (o, v) => o.slot_type = v); cfg.set_constructor(() => new SlotDto()); }); } } }