Skip to main content

api/dto/
available_game.rs

1use serde::{Deserialize, Serialize};
2
3use crate::dto::GameIdDTO;
4
5/// Represents the visibility of a game.
6///
7/// - `Private`: The game is only visible to participating players.
8/// - `Public`: The game is visible to all users and can be joined.
9#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
10pub enum AvailabilityDTO {
11    /// The game is private and only accessible to participating players.
12    Private,
13
14    /// The game is visible to all users and can be joined.
15    Public,
16}
17
18/// Games available for the end user to play.
19#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
20pub struct AvailableGameDTO {
21    /// Game identifier sortable by creation time.
22    pub game_id: GameIdDTO,
23
24    /// A human-readable name for the game, such as "liberated-happy-donkey".
25    pub name: String,
26
27    /// The availabiliy to the end user
28    pub availability: AvailabilityDTO,
29}