1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use crate::model::{prelude::*, user::SimpleUser};

/// <https://docs.github.com/en/rest/issues/milestones#get-a-milestone=>
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq)]
pub struct Milestone {
    pub closed_issues: i64,
    pub creator: Option<SimpleUser>,
    pub description: Option<String>,
    pub due_on: Option<String>,
    pub closed_at: Option<String>,
    pub id: i64,
    pub node_id: String,
    pub labels_url: String,
    pub html_url: String,
    pub number: i64,
    pub open_issues: i64,
    pub state: MilestoneState,
    pub title: String,
    pub url: String,
    pub created_at: String,
    pub updated_at: String,
}

#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize, EnumString, EnumVariantNames)]
#[serde(rename_all = "snake_case")]
pub enum MilestoneState {
    Open,
    Closed,
}

impl Default for MilestoneState {
    fn default() -> Self {
        Self::Open
    }
}