artifacts/models/
badge_schema.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5#[cfg_attr(feature = "specta", derive(specta::Type))]
6pub struct BadgeSchema {
7    /// Code of the badge. This is the badge's unique identifier (ID).
8    #[serde(rename = "code")]
9    pub code: String,
10    #[serde(
11        rename = "season",
12        default,
13        with = "::serde_with::rust::double_option",
14        skip_serializing_if = "Option::is_none"
15    )]
16    pub season: Option<Option<i32>>,
17    /// Description of the badge.
18    #[serde(rename = "description")]
19    pub description: String,
20    /// Conditions to get the badge.
21    #[serde(rename = "conditions")]
22    pub conditions: Vec<models::BadgeConditionSchema>,
23}
24
25impl BadgeSchema {
26    pub fn new(
27        code: String,
28        description: String,
29        conditions: Vec<models::BadgeConditionSchema>,
30    ) -> BadgeSchema {
31        BadgeSchema {
32            code,
33            season: None,
34            description,
35            conditions,
36        }
37    }
38}