#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum GrantSource {
Unspecified = 0,
TrialProduct = 1,
TrialSubscription = 2,
TrialPlan = 3,
TrialEnterprise = 4,
Promo = 5,
Recurring = 6,
Gift = 7,
}
impl GrantSource {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "GRANT_SOURCE_UNSPECIFIED",
Self::TrialProduct => "GRANT_SOURCE_TRIAL_PRODUCT",
Self::TrialSubscription => "GRANT_SOURCE_TRIAL_SUBSCRIPTION",
Self::TrialPlan => "GRANT_SOURCE_TRIAL_PLAN",
Self::TrialEnterprise => "GRANT_SOURCE_TRIAL_ENTERPRISE",
Self::Promo => "GRANT_SOURCE_PROMO",
Self::Recurring => "GRANT_SOURCE_RECURRING",
Self::Gift => "GRANT_SOURCE_GIFT",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"GRANT_SOURCE_UNSPECIFIED" => Some(Self::Unspecified),
"GRANT_SOURCE_TRIAL_PRODUCT" => Some(Self::TrialProduct),
"GRANT_SOURCE_TRIAL_SUBSCRIPTION" => Some(Self::TrialSubscription),
"GRANT_SOURCE_TRIAL_PLAN" => Some(Self::TrialPlan),
"GRANT_SOURCE_TRIAL_ENTERPRISE" => Some(Self::TrialEnterprise),
"GRANT_SOURCE_PROMO" => Some(Self::Promo),
"GRANT_SOURCE_RECURRING" => Some(Self::Recurring),
"GRANT_SOURCE_GIFT" => Some(Self::Gift),
_ => None,
}
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Grant {
#[prost(uint64, tag = "1")]
pub id: u64,
#[prost(uint64, tag = "2")]
pub organization_id: u64,
#[prost(enumeration = "GrantType", tag = "3")]
pub r#type: i32,
#[prost(string, repeated, tag = "4")]
pub line_item_uids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(int64, tag = "5")]
pub amount: i64,
#[prost(message, optional, tag = "6")]
pub start_date: ::core::option::Option<super::super::super::Date>,
#[prost(message, optional, tag = "7")]
pub end_date: ::core::option::Option<super::super::super::Date>,
#[prost(enumeration = "GrantStatus", tag = "8")]
pub status: i32,
#[prost(enumeration = "GrantSource", tag = "9")]
pub source: i32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum GrantType {
Unspecified = 0,
Units = 1,
Cents = 2,
}
impl GrantType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "GRANT_TYPE_UNSPECIFIED",
Self::Units => "GRANT_TYPE_UNITS",
Self::Cents => "GRANT_TYPE_CENTS",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"GRANT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"GRANT_TYPE_UNITS" => Some(Self::Units),
"GRANT_TYPE_CENTS" => Some(Self::Cents),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum GrantStatus {
Unspecified = 0,
Active = 1,
Inactive = 2,
Expired = 3,
}
impl GrantStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "GRANT_STATUS_UNSPECIFIED",
Self::Active => "GRANT_STATUS_ACTIVE",
Self::Inactive => "GRANT_STATUS_INACTIVE",
Self::Expired => "GRANT_STATUS_EXPIRED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"GRANT_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"GRANT_STATUS_ACTIVE" => Some(Self::Active),
"GRANT_STATUS_INACTIVE" => Some(Self::Inactive),
"GRANT_STATUS_EXPIRED" => Some(Self::Expired),
_ => None,
}
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateGrantRequest {
#[prost(uint64, tag = "1")]
pub organization_id: u64,
#[prost(string, optional, tag = "2")]
pub line_item_uid: ::core::option::Option<::prost::alloc::string::String>,
#[prost(message, optional, tag = "3")]
pub start_date: ::core::option::Option<super::super::super::Date>,
#[prost(message, optional, tag = "4")]
pub end_date: ::core::option::Option<super::super::super::Date>,
#[prost(enumeration = "GrantType", tag = "5")]
pub r#type: i32,
#[prost(enumeration = "GrantSource", tag = "6")]
pub source: i32,
#[prost(int64, tag = "7")]
pub amount: i64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateGrantResponse {
#[prost(bool, tag = "1")]
pub created: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct EffectiveGrant {
#[prost(uint64, tag = "1")]
pub grant_id: u64,
#[prost(enumeration = "GrantType", tag = "2")]
pub r#type: i32,
#[prost(string, repeated, tag = "3")]
pub line_item_uids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(int64, tag = "4")]
pub effective_amount: i64,
#[prost(message, optional, tag = "5")]
pub start_date: ::core::option::Option<super::super::super::Date>,
#[prost(message, optional, tag = "6")]
pub end_date: ::core::option::Option<super::super::super::Date>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetEffectiveGrantsRequest {
#[prost(uint64, tag = "1")]
pub organization_id: u64,
#[prost(string, optional, tag = "2")]
pub line_item_uid: ::core::option::Option<::prost::alloc::string::String>,
#[prost(message, optional, tag = "3")]
pub start_date: ::core::option::Option<super::super::super::Date>,
#[prost(message, optional, tag = "4")]
pub end_date: ::core::option::Option<super::super::super::Date>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetEffectiveGrantsResponse {
#[prost(message, repeated, tag = "1")]
pub effective_grants: ::prost::alloc::vec::Vec<EffectiveGrant>,
}