#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum SnsProposalsSort {
#[default]
Api,
Id,
Title,
Action,
Yes,
No,
TotalVotes,
Created,
Decided,
Executed,
Failed,
}
impl SnsProposalsSort {
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::Api => "api",
Self::Id => "id",
Self::Title => "title",
Self::Action => "action",
Self::Yes => "yes",
Self::No => "no",
Self::TotalVotes => "total-votes",
Self::Created => "created",
Self::Decided => "decided",
Self::Executed => "executed",
Self::Failed => "failed",
}
}
}
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum SnsProposalSortDirection {
Asc,
#[default]
Desc,
}
impl SnsProposalSortDirection {
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::Asc => "asc",
Self::Desc => "desc",
}
}
}
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum SnsProposalStatusFilter {
#[default]
Any,
Open,
Decided,
Rejected,
Adopted,
Executed,
Failed,
}
impl SnsProposalStatusFilter {
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::Any => "any",
Self::Open => "open",
Self::Decided => "decided",
Self::Rejected => "rejected",
Self::Adopted => "adopted",
Self::Executed => "executed",
Self::Failed => "failed",
}
}
#[must_use]
pub const fn governance_status_code(self) -> Option<i32> {
match self {
Self::Any | Self::Decided => None,
Self::Open => Some(1),
Self::Rejected => Some(2),
Self::Adopted => Some(3),
Self::Executed => Some(4),
Self::Failed => Some(5),
}
}
}
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum SnsProposalTopicFilter {
#[default]
Any,
DaoCommunitySettings,
SnsFrameworkManagement,
DappCanisterManagement,
ApplicationBusinessLogic,
Governance,
TreasuryAssetManagement,
CriticalDappOperations,
}
impl SnsProposalTopicFilter {
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::Any => "any",
Self::DaoCommunitySettings => "dao-community-settings",
Self::SnsFrameworkManagement => "sns-framework-management",
Self::DappCanisterManagement => "dapp-canister-management",
Self::ApplicationBusinessLogic => "application-business-logic",
Self::Governance => "governance",
Self::TreasuryAssetManagement => "treasury-asset-management",
Self::CriticalDappOperations => "critical-dapp-operations",
}
}
}