Skip to main content

blockfrost_openapi/models/
proposal_votes_inner.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct ProposalVotesInner {
6    /// Hash of the voting transaction.
7    #[serde(rename = "tx_hash")]
8    pub tx_hash: String,
9    /// Index of the certificate within the voting transaction.
10    #[serde(rename = "cert_index")]
11    pub cert_index: i32,
12    /// The role of the voter. Can be one of constitutional_committee, drep, spo.
13    #[serde(rename = "voter_role")]
14    pub voter_role: VoterRole,
15    /// The actual voter.
16    #[serde(rename = "voter")]
17    pub voter: String,
18    /// The Vote. Can be one of yes, no, abstain.
19    #[serde(rename = "vote")]
20    pub vote: Vote,
21}
22
23impl ProposalVotesInner {
24    pub fn new(tx_hash: String, cert_index: i32, voter_role: VoterRole, voter: String, vote: Vote) -> ProposalVotesInner {
25        ProposalVotesInner {
26            tx_hash,
27            cert_index,
28            voter_role,
29            voter,
30            vote,
31        }
32    }
33}
34/// The role of the voter. Can be one of constitutional_committee, drep, spo.
35#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
36pub enum VoterRole {
37    #[serde(rename = "constitutional_committee")]
38    ConstitutionalCommittee,
39    #[serde(rename = "drep")]
40    Drep,
41    #[serde(rename = "spo")]
42    Spo,
43}
44
45impl Default for VoterRole {
46    fn default() -> VoterRole {
47        Self::ConstitutionalCommittee
48    }
49}
50/// The Vote. Can be one of yes, no, abstain.
51#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
52pub enum Vote {
53    #[serde(rename = "yes")]
54    Yes,
55    #[serde(rename = "no")]
56    No,
57    #[serde(rename = "abstain")]
58    Abstain,
59}
60
61impl Default for Vote {
62    fn default() -> Vote {
63        Self::Yes
64    }
65}
66