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    /// Season of the badge.
11    #[serde(rename = "season", skip_serializing_if = "Option::is_none")]
12    pub season: Option<i32>,
13    /// Description of the badge.
14    #[serde(rename = "description")]
15    pub description: String,
16    /// Conditions to get the badge.
17    #[serde(rename = "conditions")]
18    pub conditions: Vec<models::BadgeConditionSchema>,
19}
20
21impl BadgeSchema {
22    pub fn new(
23        code: String,
24        description: String,
25        conditions: Vec<models::BadgeConditionSchema>,
26    ) -> BadgeSchema {
27        BadgeSchema {
28            code,
29            season: None,
30            description,
31            conditions,
32        }
33    }
34}