pub struct Quote {Show 23 fields
pub id: Uuid,
pub building_id: Uuid,
pub contractor_id: Uuid,
pub project_title: String,
pub project_description: String,
pub work_category: Option<String>,
pub amount_excl_vat: Option<Decimal>,
pub vat_rate: Option<Decimal>,
pub amount_incl_vat: Option<Decimal>,
pub validity_date: Option<DateTime<Utc>>,
pub estimated_start_date: Option<DateTime<Utc>>,
pub estimated_duration_days: Option<i32>,
pub warranty_years: i32,
pub contractor_rating: Option<i32>,
pub status: QuoteStatus,
pub requested_at: DateTime<Utc>,
pub submitted_at: Option<DateTime<Utc>>,
pub reviewed_at: Option<DateTime<Utc>>,
pub decision_at: Option<DateTime<Utc>>,
pub decision_by: Option<Uuid>,
pub decision_notes: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
Quote for contractor work (Belgian professional best practice: 3 quotes for works >5000€)
2-phase workflow: a quote is requested (title/description/category only —
nobody knows the price yet) then submitted (contractor’s actual pricing,
via submit()). Price/terms fields are therefore None until the quote
reaches QuoteStatus::Received.
Fields§
§id: Uuid§building_id: Uuid§contractor_id: Uuid§project_title: String§project_description: String§work_category: Option<String>§amount_excl_vat: Option<Decimal>§vat_rate: Option<Decimal>§amount_incl_vat: Option<Decimal>§validity_date: Option<DateTime<Utc>>§estimated_start_date: Option<DateTime<Utc>>§estimated_duration_days: Option<i32>§warranty_years: i32§contractor_rating: Option<i32>§status: QuoteStatus§requested_at: DateTime<Utc>§submitted_at: Option<DateTime<Utc>>§reviewed_at: Option<DateTime<Utc>>§decision_at: Option<DateTime<Utc>>§decision_by: Option<Uuid>§decision_notes: Option<String>§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl Quote
impl Quote
Sourcepub fn new(
building_id: Uuid,
contractor_id: Uuid,
project_title: String,
project_description: String,
work_category: Option<String>,
warranty_years: i32,
) -> Result<Self, String>
pub fn new( building_id: Uuid, contractor_id: Uuid, project_title: String, project_description: String, work_category: Option<String>, warranty_years: i32, ) -> Result<Self, String>
Create new quote request — request phase only, no pricing (cf. struct docs).
Sourcepub fn submit(&mut self, pricing: Option<QuoteSubmission>) -> Result<(), String>
pub fn submit(&mut self, pricing: Option<QuoteSubmission>) -> Result<(), String>
Submit quote (contractor/syndic action) — moves Requested -> Received.
pricing carries the contractor’s actual price/terms and is validated
here (this is where those rules now live, moved from new()). Passing
None is only valid when the quote already carries price data (e.g.
it was created with pricing already known) — otherwise this errors,
since a Received quote without a price makes no sense.
Sourcepub fn set_initial_pricing(
&mut self,
pricing: QuoteSubmission,
) -> Result<(), String>
pub fn set_initial_pricing( &mut self, pricing: QuoteSubmission, ) -> Result<(), String>
Set pricing on a quote that is still Requested (does NOT transition
status — unlike submit()). Backward-compat escape hatch for callers
that already know the price when requesting the quote (e.g. a syndic
manually recording a quote received by phone/email/paper): the quote
still goes through the normal submit() step afterward.
Sourcepub fn start_review(&mut self) -> Result<(), String>
pub fn start_review(&mut self) -> Result<(), String>
Mark quote under review (Syndic action)
Sourcepub fn accept(
&mut self,
decision_by: Uuid,
decision_notes: Option<String>,
) -> Result<(), String>
pub fn accept( &mut self, decision_by: Uuid, decision_notes: Option<String>, ) -> Result<(), String>
Accept quote (winning bid)
Sourcepub fn reject(
&mut self,
decision_by: Uuid,
decision_notes: Option<String>,
) -> Result<(), String>
pub fn reject( &mut self, decision_by: Uuid, decision_notes: Option<String>, ) -> Result<(), String>
Reject quote (losing bid or unqualified)
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if quote is expired
Sourcepub fn mark_expired(&mut self) -> Result<(), String>
pub fn mark_expired(&mut self) -> Result<(), String>
Mark quote as expired (background job)
Sourcepub fn set_contractor_rating(&mut self, rating: i32) -> Result<(), String>
pub fn set_contractor_rating(&mut self, rating: i32) -> Result<(), String>
Update contractor rating (from historical data)
Sourcepub fn calculate_score(
&self,
min_price: Decimal,
max_price: Decimal,
min_duration: i32,
max_duration: i32,
max_warranty: i32,
) -> Result<QuoteScore, String>
pub fn calculate_score( &self, min_price: Decimal, max_price: Decimal, min_duration: i32, max_duration: i32, max_warranty: i32, ) -> Result<QuoteScore, String>
Calculate automatic score (Belgian best practices) Algorithm: price (40%), delay (30%), warranty (20%), reputation (10%) Returns QuoteScore with breakdown
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Quote
impl<'de> Deserialize<'de> for Quote
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<Quote> for QuoteResponseDto
impl From<Quote> for QuoteResponseDto
impl StructuralPartialEq for Quote
Auto Trait Implementations§
impl Freeze for Quote
impl RefUnwindSafe for Quote
impl Send for Quote
impl Sync for Quote
impl Unpin for Quote
impl UnsafeUnpin for Quote
impl UnwindSafe for Quote
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