Skip to main content

Quote

Struct Quote 

Source
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

Source

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).

Source

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.

Source

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.

Source

pub fn start_review(&mut self) -> Result<(), String>

Mark quote under review (Syndic action)

Source

pub fn accept( &mut self, decision_by: Uuid, decision_notes: Option<String>, ) -> Result<(), String>

Accept quote (winning bid)

Source

pub fn reject( &mut self, decision_by: Uuid, decision_notes: Option<String>, ) -> Result<(), String>

Reject quote (losing bid or unqualified)

Source

pub fn withdraw(&mut self) -> Result<(), String>

Withdraw quote (contractor action)

Source

pub fn is_expired(&self) -> bool

Check if quote is expired

Source

pub fn mark_expired(&mut self) -> Result<(), String>

Mark quote as expired (background job)

Source

pub fn set_contractor_rating(&mut self, rating: i32) -> Result<(), String>

Update contractor rating (from historical data)

Source

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 Clone for Quote

Source§

fn clone(&self) -> Quote

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Quote

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Quote

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Quote> for QuoteResponseDto

Source§

fn from(quote: Quote) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Quote

Source§

fn eq(&self, other: &Quote) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Quote

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Fake for T

§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: RngExt + ?Sized, Self: FakeBase<U>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more