// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: social.drydown.review
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

#[allow(unused_imports)]
use alloc::collections::BTreeMap;

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
/// A single wearing review of a fragrance

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Review<'a> {
    ///Final: Depth and evolution (1-5)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub complexity: Option<i64>,
    ///Timestamp when the review was created
    pub created_at: Datetime,
    ///Mid-Wear: How it smells after settling (1-5)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub drydown_rating: Option<i64>,
    ///Elevation in meters above sea level
    #[serde(skip_serializing_if = "Option::is_none")]
    pub elevation: Option<i64>,
    ///Final: How it smells at the end (1-5)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub end_rating: Option<i64>,
    ///Reference to the social.drydown.fragrance record
    #[serde(borrow)]
    pub fragrance: AtUri<'a>,
    ///Final: Total duration (1-5)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub longevity: Option<i64>,
    ///Mid-Wear: Scent bubble radius during mid-wear (1-5)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mid_projection: Option<i64>,
    ///First Impression: Immediate scent bubble radius (1-5)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub opening_projection: Option<i64>,
    ///First Impression: How it smells immediately (1-5)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub opening_rating: Option<i64>,
    ///Final: Holistic 'Gut Score' (1-5)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub overall_rating: Option<i64>,
    ///Mid-Wear: Trail left behind (1-5)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sillage: Option<i64>,
    ///Temperature in Celsius at Stage 1 * 10 (e.g. 225 = 22.5°C)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub stage1_temp: Option<i64>,
    ///Timestamp when Stage 2 was completed (for accurate temperature)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub stage2_completed_at: Option<Datetime>,
    ///Temperature in Celsius at Stage 2 * 10 (e.g. 225 = 22.5°C)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub stage2_temp: Option<i64>,
    ///Temperature in Celsius at Stage 3 * 10 (e.g. 225 = 22.5°C)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub stage3_temp: Option<i64>,
    ///Written review (max 255 graphemes)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub text: Option<CowStr<'a>>,
    ///Daily maximum UV index (0-11+)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub uv_index: Option<i64>,
    ///User opted in to weather data collection
    #[serde(skip_serializing_if = "Option::is_none")]
    pub weather_opt_in: Option<bool>,
    ///Calculated final score * 1000 (e.g. 4250 = 4.25)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub weighted_score: Option<i64>,
}

/// Typed wrapper for GetRecord response with this collection's record type.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReviewGetRecordOutput<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub cid: Option<Cid<'a>>,
    #[serde(borrow)]
    pub uri: AtUri<'a>,
    #[serde(borrow)]
    pub value: Review<'a>,
}

impl<'a> Review<'a> {
    pub fn uri(
        uri: impl Into<CowStr<'a>>,
    ) -> Result<RecordUri<'a, ReviewRecord>, UriError> {
        RecordUri::try_from_uri(AtUri::new_cow(uri.into())?)
    }
}

/// Marker type for deserializing records from this collection.

#[derive(Debug, Serialize, Deserialize)]
pub struct ReviewRecord;
impl XrpcResp for ReviewRecord {
    const NSID: &'static str = "social.drydown.review";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = ReviewGetRecordOutput<'de>;
    type Err<'de> = RecordError<'de>;
}

impl From<ReviewGetRecordOutput<'_>> for Review<'_> {
    fn from(output: ReviewGetRecordOutput<'_>) -> Self {
        use jacquard_common::IntoStatic;
        output.value.into_static()
    }
}

impl Collection for Review<'_> {
    const NSID: &'static str = "social.drydown.review";
    type Record = ReviewRecord;
}

impl Collection for ReviewRecord {
    const NSID: &'static str = "social.drydown.review";
    type Record = ReviewRecord;
}

impl<'a> LexiconSchema for Review<'a> {
    fn nsid() -> &'static str {
        "social.drydown.review"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_drydown_review()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.complexity {
            if *value > 5i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("complexity"),
                    max: 5i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.complexity {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("complexity"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.drydown_rating {
            if *value > 5i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("drydown_rating"),
                    max: 5i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.drydown_rating {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("drydown_rating"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.end_rating {
            if *value > 5i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("end_rating"),
                    max: 5i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.end_rating {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("end_rating"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.longevity {
            if *value > 5i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("longevity"),
                    max: 5i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.longevity {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("longevity"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.mid_projection {
            if *value > 5i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("mid_projection"),
                    max: 5i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.mid_projection {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("mid_projection"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.opening_projection {
            if *value > 5i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("opening_projection"),
                    max: 5i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.opening_projection {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("opening_projection"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.opening_rating {
            if *value > 5i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("opening_rating"),
                    max: 5i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.opening_rating {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("opening_rating"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.overall_rating {
            if *value > 5i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("overall_rating"),
                    max: 5i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.overall_rating {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("overall_rating"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.sillage {
            if *value > 5i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("sillage"),
                    max: 5i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.sillage {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("sillage"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.text {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 3000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("text"),
                    max: 3000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.text {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 255usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("text"),
                        max: 255usize,
                        actual: count,
                    });
                }
            }
        }
        if let Some(ref value) = self.uv_index {
            if *value > 11i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("uv_index"),
                    max: 11i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.uv_index {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("uv_index"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

pub mod review_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Fragrance;
        type CreatedAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Fragrance = Unset;
        type CreatedAt = Unset;
    }
    ///State transition - sets the `fragrance` field to Set
    pub struct SetFragrance<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetFragrance<S> {}
    impl<S: State> State for SetFragrance<S> {
        type Fragrance = Set<members::fragrance>;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type Fragrance = S::Fragrance;
        type CreatedAt = Set<members::created_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `fragrance` field
        pub struct fragrance(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
    }
}

/// Builder for constructing an instance of this type
pub struct ReviewBuilder<'a, S: review_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<i64>,
        Option<Datetime>,
        Option<i64>,
        Option<i64>,
        Option<i64>,
        Option<AtUri<'a>>,
        Option<i64>,
        Option<i64>,
        Option<i64>,
        Option<i64>,
        Option<i64>,
        Option<i64>,
        Option<i64>,
        Option<Datetime>,
        Option<i64>,
        Option<i64>,
        Option<CowStr<'a>>,
        Option<i64>,
        Option<bool>,
        Option<i64>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> Review<'a> {
    /// Create a new builder for this type
    pub fn new() -> ReviewBuilder<'a, review_state::Empty> {
        ReviewBuilder::new()
    }
}

impl<'a> ReviewBuilder<'a, review_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        ReviewBuilder {
            _state: PhantomData,
            _fields: (
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
            ),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `complexity` field (optional)
    pub fn complexity(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `complexity` field to an Option value (optional)
    pub fn maybe_complexity(mut self, value: Option<i64>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<'a, S> ReviewBuilder<'a, S>
where
    S: review_state::State,
    S::CreatedAt: review_state::IsUnset,
{
    /// Set the `createdAt` field (required)
    pub fn created_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> ReviewBuilder<'a, review_state::SetCreatedAt<S>> {
        self._fields.1 = Option::Some(value.into());
        ReviewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `drydownRating` field (optional)
    pub fn drydown_rating(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `drydownRating` field to an Option value (optional)
    pub fn maybe_drydown_rating(mut self, value: Option<i64>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `elevation` field (optional)
    pub fn elevation(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `elevation` field to an Option value (optional)
    pub fn maybe_elevation(mut self, value: Option<i64>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `endRating` field (optional)
    pub fn end_rating(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `endRating` field to an Option value (optional)
    pub fn maybe_end_rating(mut self, value: Option<i64>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<'a, S> ReviewBuilder<'a, S>
where
    S: review_state::State,
    S::Fragrance: review_state::IsUnset,
{
    /// Set the `fragrance` field (required)
    pub fn fragrance(
        mut self,
        value: impl Into<AtUri<'a>>,
    ) -> ReviewBuilder<'a, review_state::SetFragrance<S>> {
        self._fields.5 = Option::Some(value.into());
        ReviewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `longevity` field (optional)
    pub fn longevity(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `longevity` field to an Option value (optional)
    pub fn maybe_longevity(mut self, value: Option<i64>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `midProjection` field (optional)
    pub fn mid_projection(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `midProjection` field to an Option value (optional)
    pub fn maybe_mid_projection(mut self, value: Option<i64>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `openingProjection` field (optional)
    pub fn opening_projection(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `openingProjection` field to an Option value (optional)
    pub fn maybe_opening_projection(mut self, value: Option<i64>) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `openingRating` field (optional)
    pub fn opening_rating(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `openingRating` field to an Option value (optional)
    pub fn maybe_opening_rating(mut self, value: Option<i64>) -> Self {
        self._fields.9 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `overallRating` field (optional)
    pub fn overall_rating(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `overallRating` field to an Option value (optional)
    pub fn maybe_overall_rating(mut self, value: Option<i64>) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `sillage` field (optional)
    pub fn sillage(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `sillage` field to an Option value (optional)
    pub fn maybe_sillage(mut self, value: Option<i64>) -> Self {
        self._fields.11 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `stage1Temp` field (optional)
    pub fn stage1_temp(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.12 = value.into();
        self
    }
    /// Set the `stage1Temp` field to an Option value (optional)
    pub fn maybe_stage1_temp(mut self, value: Option<i64>) -> Self {
        self._fields.12 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `stage2CompletedAt` field (optional)
    pub fn stage2_completed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.13 = value.into();
        self
    }
    /// Set the `stage2CompletedAt` field to an Option value (optional)
    pub fn maybe_stage2_completed_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `stage2Temp` field (optional)
    pub fn stage2_temp(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.14 = value.into();
        self
    }
    /// Set the `stage2Temp` field to an Option value (optional)
    pub fn maybe_stage2_temp(mut self, value: Option<i64>) -> Self {
        self._fields.14 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `stage3Temp` field (optional)
    pub fn stage3_temp(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.15 = value.into();
        self
    }
    /// Set the `stage3Temp` field to an Option value (optional)
    pub fn maybe_stage3_temp(mut self, value: Option<i64>) -> Self {
        self._fields.15 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `text` field (optional)
    pub fn text(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.16 = value.into();
        self
    }
    /// Set the `text` field to an Option value (optional)
    pub fn maybe_text(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.16 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `uvIndex` field (optional)
    pub fn uv_index(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.17 = value.into();
        self
    }
    /// Set the `uvIndex` field to an Option value (optional)
    pub fn maybe_uv_index(mut self, value: Option<i64>) -> Self {
        self._fields.17 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `weatherOptIn` field (optional)
    pub fn weather_opt_in(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.18 = value.into();
        self
    }
    /// Set the `weatherOptIn` field to an Option value (optional)
    pub fn maybe_weather_opt_in(mut self, value: Option<bool>) -> Self {
        self._fields.18 = value;
        self
    }
}

impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
    /// Set the `weightedScore` field (optional)
    pub fn weighted_score(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.19 = value.into();
        self
    }
    /// Set the `weightedScore` field to an Option value (optional)
    pub fn maybe_weighted_score(mut self, value: Option<i64>) -> Self {
        self._fields.19 = value;
        self
    }
}

impl<'a, S> ReviewBuilder<'a, S>
where
    S: review_state::State,
    S::Fragrance: review_state::IsSet,
    S::CreatedAt: review_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> Review<'a> {
        Review {
            complexity: self._fields.0,
            created_at: self._fields.1.unwrap(),
            drydown_rating: self._fields.2,
            elevation: self._fields.3,
            end_rating: self._fields.4,
            fragrance: self._fields.5.unwrap(),
            longevity: self._fields.6,
            mid_projection: self._fields.7,
            opening_projection: self._fields.8,
            opening_rating: self._fields.9,
            overall_rating: self._fields.10,
            sillage: self._fields.11,
            stage1_temp: self._fields.12,
            stage2_completed_at: self._fields.13,
            stage2_temp: self._fields.14,
            stage3_temp: self._fields.15,
            text: self._fields.16,
            uv_index: self._fields.17,
            weather_opt_in: self._fields.18,
            weighted_score: self._fields.19,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> Review<'a> {
        Review {
            complexity: self._fields.0,
            created_at: self._fields.1.unwrap(),
            drydown_rating: self._fields.2,
            elevation: self._fields.3,
            end_rating: self._fields.4,
            fragrance: self._fields.5.unwrap(),
            longevity: self._fields.6,
            mid_projection: self._fields.7,
            opening_projection: self._fields.8,
            opening_rating: self._fields.9,
            overall_rating: self._fields.10,
            sillage: self._fields.11,
            stage1_temp: self._fields.12,
            stage2_completed_at: self._fields.13,
            stage2_temp: self._fields.14,
            stage3_temp: self._fields.15,
            text: self._fields.16,
            uv_index: self._fields.17,
            weather_opt_in: self._fields.18,
            weighted_score: self._fields.19,
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_social_drydown_review() -> LexiconDoc<'static> {
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    use alloc::collections::BTreeMap;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("social.drydown.review"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    description: Some(
                        CowStr::new_static("A single wearing review of a fragrance"),
                    ),
                    key: Some(CowStr::new_static("tid")),
                    record: LexRecordRecord::Object(LexObject {
                        required: Some(
                            vec![
                                SmolStr::new_static("fragrance"),
                                SmolStr::new_static("createdAt")
                            ],
                        ),
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("complexity"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    maximum: Some(5i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("createdAt"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Timestamp when the review was created"),
                                    ),
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("drydownRating"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    maximum: Some(5i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("elevation"),
                                LexObjectProperty::Integer(LexInteger {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("endRating"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    maximum: Some(5i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("fragrance"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "Reference to the social.drydown.fragrance record",
                                        ),
                                    ),
                                    format: Some(LexStringFormat::AtUri),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("longevity"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    maximum: Some(5i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("midProjection"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    maximum: Some(5i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("openingProjection"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    maximum: Some(5i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("openingRating"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    maximum: Some(5i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("overallRating"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    maximum: Some(5i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("sillage"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    maximum: Some(5i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("stage1Temp"),
                                LexObjectProperty::Integer(LexInteger {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("stage2CompletedAt"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "Timestamp when Stage 2 was completed (for accurate temperature)",
                                        ),
                                    ),
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("stage2Temp"),
                                LexObjectProperty::Integer(LexInteger {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("stage3Temp"),
                                LexObjectProperty::Integer(LexInteger {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("text"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Written review (max 255 graphemes)"),
                                    ),
                                    max_length: Some(3000usize),
                                    max_graphemes: Some(255usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("uvIndex"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(0i64),
                                    maximum: Some(11i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("weatherOptIn"),
                                LexObjectProperty::Boolean(LexBoolean {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("weightedScore"),
                                LexObjectProperty::Integer(LexInteger {
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}