pub struct ProviderOffer {
pub id: Uuid,
pub campaign_id: Uuid,
pub provider_name: String,
pub price_kwh_electricity: Option<Decimal>,
pub price_kwh_gas: Option<Decimal>,
pub fixed_monthly_fee: Decimal,
pub green_energy_pct: f64,
pub contract_duration_months: i32,
pub estimated_savings_pct: f64,
pub offer_valid_until: DateTime<Utc>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Fields§
§id: Uuid§campaign_id: Uuid§provider_name: String§price_kwh_electricity: Option<Decimal>Prix du kWh électrique, en euros.
Decimal et non f64 (ADR-0008 § A) : c’est un montant, multiplié par
une consommation pour produire une facture. La dérive s’y accumule
d’autant plus qu’un prix au kWh se compte en millièmes d’euro et se
multiplie par des milliers d’unités.
L’enjeu n’est pas cosmétique : ces prix servent à comparer des offres pour un achat groupé, et l’économie annoncée aux copropriétaires en découle. Une comparaison faussée oriente une décision collective.
price_kwh_gas: Option<Decimal>Prix du kWh gaz, en euros. Même raison.
fixed_monthly_fee: DecimalRedevance mensuelle fixe, en euros. Elle s’additionne sur la durée du contrat, souvent trente-six mois.
green_energy_pct: f64Part d’énergie verte, en pourcentage d’affichage.
Reste en f64 : ce n’est ni un montant ni une quotité, et il n’est
jamais comparé à un seuil légal (carve-out ADR-0008 § A).
contract_duration_months: i32§estimated_savings_pct: f64§offer_valid_until: DateTime<Utc>§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl ProviderOffer
impl ProviderOffer
Sourcepub fn new(
campaign_id: Uuid,
provider_name: String,
price_kwh_electricity: Option<Decimal>,
price_kwh_gas: Option<Decimal>,
fixed_monthly_fee: Decimal,
green_energy_pct: f64,
contract_duration_months: i32,
estimated_savings_pct: f64,
offer_valid_until: DateTime<Utc>,
) -> Result<Self, String>
pub fn new( campaign_id: Uuid, provider_name: String, price_kwh_electricity: Option<Decimal>, price_kwh_gas: Option<Decimal>, fixed_monthly_fee: Decimal, green_energy_pct: f64, contract_duration_months: i32, estimated_savings_pct: f64, offer_valid_until: DateTime<Utc>, ) -> Result<Self, String>
Créer nouvelle offre fournisseur
Sourcepub fn green_score(&self) -> i32
pub fn green_score(&self) -> i32
Calculer score vert (pour nudge behavioral)
Trait Implementations§
Source§impl Clone for ProviderOffer
impl Clone for ProviderOffer
Source§fn clone(&self) -> ProviderOffer
fn clone(&self) -> ProviderOffer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProviderOffer
impl Debug for ProviderOffer
Source§impl<'de> Deserialize<'de> for ProviderOffer
impl<'de> Deserialize<'de> for ProviderOffer
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<ProviderOffer> for ProviderOfferResponse
impl From<ProviderOffer> for ProviderOfferResponse
Source§fn from(offer: ProviderOffer) -> Self
fn from(offer: ProviderOffer) -> Self
Source§impl PartialEq for ProviderOffer
impl PartialEq for ProviderOffer
Source§fn eq(&self, other: &ProviderOffer) -> bool
fn eq(&self, other: &ProviderOffer) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ProviderOffer
impl Serialize for ProviderOffer
impl StructuralPartialEq for ProviderOffer
Auto Trait Implementations§
impl Freeze for ProviderOffer
impl RefUnwindSafe for ProviderOffer
impl Send for ProviderOffer
impl Sync for ProviderOffer
impl Unpin for ProviderOffer
impl UnsafeUnpin for ProviderOffer
impl UnwindSafe for ProviderOffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more