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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use super::FundInfo;
use serde::{Deserialize, Serialize};
use time::{ext::NumericalDuration, OffsetDateTime};

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NextFund {
    #[serde(flatten)]
    pub fund_info: FundInfo,
    pub dates: NextFundDates,
}

impl Default for NextFund {
    fn default() -> Self {
        Self {
            dates: Default::default(),
            fund_info: 10i32.into(),
        }
    }
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NextFundDates {
    #[serde(with = "time::serde::rfc3339")]
    pub insight_sharing_start: OffsetDateTime,
    #[serde(with = "time::serde::rfc3339")]
    pub proposal_submission_start: OffsetDateTime,
    #[serde(with = "time::serde::rfc3339")]
    pub refine_proposals_start: OffsetDateTime,
    #[serde(with = "time::serde::rfc3339")]
    pub finalize_proposals_start: OffsetDateTime,
    #[serde(with = "time::serde::rfc3339")]
    pub proposal_assessment_start: OffsetDateTime,
    #[serde(with = "time::serde::rfc3339")]
    pub assessment_qa_start: OffsetDateTime,
    #[serde(with = "time::serde::rfc3339")]
    pub snapshot_time: OffsetDateTime,
    #[serde(with = "time::serde::rfc3339")]
    pub voting_start: OffsetDateTime,
    #[serde(with = "time::serde::rfc3339")]
    pub voting_tally_start: OffsetDateTime,
    #[serde(with = "time::serde::rfc3339")]
    pub voting_tally_end: OffsetDateTime,
    #[serde(with = "time::serde::rfc3339")]
    pub next_snapshot_time: OffsetDateTime,
    #[serde(with = "time::serde::rfc3339")]
    pub next_vote_start_time: OffsetDateTime,
}

impl Default for NextFundDates {
    fn default() -> Self {
        let now = OffsetDateTime::now_utc();
        Self {
            insight_sharing_start: now + 5.days(),
            proposal_submission_start: now + 6.days(),
            refine_proposals_start: now + 7.days(),
            finalize_proposals_start: now + 8.days(),
            proposal_assessment_start: now + 9.days(),
            assessment_qa_start: now + 10.days(),
            snapshot_time: now + 20.days(),
            voting_start: now + 30.days(),
            voting_tally_start: now + 31.days(),
            voting_tally_end: now + 32.days(),
            next_snapshot_time: now + 40.days(),
            next_vote_start_time: now + 50.days(),
        }
    }
}