// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: garden.goals.goal
//
// 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, BosStr, DefaultStr, FromStaticStr};

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::blob::BlobRef;
use jacquard_common::types::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime, UriValue};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::types::value::Data;
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 goal to track daily completions for a year.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
    rename_all = "camelCase",
    rename = "garden.goals.goal",
    tag = "$type",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Goal<S: BosStr = DefaultStr> {
    ///Preset name or hex color for incomplete state
    #[serde(skip_serializing_if = "Option::is_none")]
    pub accent_color: Option<S>,
    ///Array of category UUIDs this goal belongs to
    #[serde(skip_serializing_if = "Option::is_none")]
    pub categories: Option<Vec<S>>,
    ///Preset name or hex color for complete state
    #[serde(skip_serializing_if = "Option::is_none")]
    pub completed_accent_color: Option<S>,
    ///Shape name or emoji for complete state
    #[serde(skip_serializing_if = "Option::is_none")]
    pub completed_piece: Option<S>,
    ///Uploaded image for complete state
    #[serde(skip_serializing_if = "Option::is_none")]
    pub completed_piece_blob: Option<BlobRef<S>>,
    ///Favicon URL for complete state
    #[serde(skip_serializing_if = "Option::is_none")]
    pub completed_piece_url: Option<UriValue<S>>,
    ///Timestamp when the goal was created
    pub created_at: Datetime,
    ///Optional description of the goal
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<S>,
    ///Unique identifier for the goal (UUID)
    pub goal_id: S,
    ///Display name of the goal
    pub name: S,
    ///Shape name or emoji for incomplete state
    #[serde(skip_serializing_if = "Option::is_none")]
    pub piece: Option<S>,
    ///Uploaded image for incomplete state
    #[serde(skip_serializing_if = "Option::is_none")]
    pub piece_blob: Option<BlobRef<S>>,
    ///Favicon URL for incomplete state
    #[serde(skip_serializing_if = "Option::is_none")]
    pub piece_url: Option<UriValue<S>>,
    ///Target count for countable goals
    #[serde(skip_serializing_if = "Option::is_none")]
    pub target_count: Option<i64>,
    ///Year this goal is tracked for
    pub year: i64,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// 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 GoalGetRecordOutput<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cid: Option<Cid<S>>,
    pub uri: AtUri<S>,
    pub value: Goal<S>,
}

impl<S: BosStr> Goal<S> {
    pub fn uri(uri: S) -> Result<RecordUri<S, GoalRecord>, UriError> {
        RecordUri::try_from_uri(AtUri::new(uri)?)
    }
}

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

#[derive(Debug, Serialize, Deserialize)]
pub struct GoalRecord;
impl XrpcResp for GoalRecord {
    const NSID: &'static str = "garden.goals.goal";
    const ENCODING: &'static str = "application/json";
    type Output<S: BosStr> = GoalGetRecordOutput<S>;
    type Err = RecordError;
}

impl<S: BosStr> From<GoalGetRecordOutput<S>> for Goal<S> {
    fn from(output: GoalGetRecordOutput<S>) -> Self {
        output.value
    }
}

impl<S: BosStr> Collection for Goal<S> {
    const NSID: &'static str = "garden.goals.goal";
    type Record = GoalRecord;
}

impl Collection for GoalRecord {
    const NSID: &'static str = "garden.goals.goal";
    type Record = GoalRecord;
}

impl<S: BosStr> LexiconSchema for Goal<S> {
    fn nsid() -> &'static str {
        "garden.goals.goal"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_garden_goals_goal()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.accent_color {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 50usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("accent_color"),
                    max: 50usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.completed_accent_color {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 50usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("completed_accent_color"),
                    max: 50usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.completed_piece {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("completed_piece"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.completed_piece_blob {
            {
                let size = value.blob().size;
                if size > 1000000usize {
                    return Err(ConstraintError::BlobTooLarge {
                        path: ValidationPath::from_field("completed_piece_blob"),
                        max: 1000000usize,
                        actual: size,
                    });
                }
            }
        }
        if let Some(ref value) = self.completed_piece_blob {
            {
                let mime = value.blob().mime_type.as_str();
                let accepted: &[&str] = &["image/*"];
                let matched = accepted
                    .iter()
                    .any(|pattern| {
                        if *pattern == "*/*" {
                            true
                        } else if pattern.ends_with("/*") {
                            let prefix = &pattern[..pattern.len() - 2];
                            mime.starts_with(prefix)
                                && mime.as_bytes().get(prefix.len()) == Some(&b'/')
                        } else {
                            mime == *pattern
                        }
                    });
                if !matched {
                    return Err(ConstraintError::BlobMimeTypeNotAccepted {
                        path: ValidationPath::from_field("completed_piece_blob"),
                        accepted: vec!["image/*".to_string()],
                        actual: mime.to_string(),
                    });
                }
            }
        }
        if let Some(ref value) = self.description {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("description"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.goal_id;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 64usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("goal_id"),
                    max: 64usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.name;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("name"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.piece {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("piece"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.piece_blob {
            {
                let size = value.blob().size;
                if size > 1000000usize {
                    return Err(ConstraintError::BlobTooLarge {
                        path: ValidationPath::from_field("piece_blob"),
                        max: 1000000usize,
                        actual: size,
                    });
                }
            }
        }
        if let Some(ref value) = self.piece_blob {
            {
                let mime = value.blob().mime_type.as_str();
                let accepted: &[&str] = &["image/*"];
                let matched = accepted
                    .iter()
                    .any(|pattern| {
                        if *pattern == "*/*" {
                            true
                        } else if pattern.ends_with("/*") {
                            let prefix = &pattern[..pattern.len() - 2];
                            mime.starts_with(prefix)
                                && mime.as_bytes().get(prefix.len()) == Some(&b'/')
                        } else {
                            mime == *pattern
                        }
                    });
                if !matched {
                    return Err(ConstraintError::BlobMimeTypeNotAccepted {
                        path: ValidationPath::from_field("piece_blob"),
                        accepted: vec!["image/*".to_string()],
                        actual: mime.to_string(),
                    });
                }
            }
        }
        if let Some(ref value) = self.target_count {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("target_count"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.year;
            if *value < 1970i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("year"),
                    min: 1970i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

pub mod goal_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 CreatedAt;
        type GoalId;
        type Name;
        type Year;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type CreatedAt = Unset;
        type GoalId = Unset;
        type Name = Unset;
        type Year = Unset;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
    impl<St: State> State for SetCreatedAt<St> {
        type CreatedAt = Set<members::created_at>;
        type GoalId = St::GoalId;
        type Name = St::Name;
        type Year = St::Year;
    }
    ///State transition - sets the `goal_id` field to Set
    pub struct SetGoalId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetGoalId<St> {}
    impl<St: State> State for SetGoalId<St> {
        type CreatedAt = St::CreatedAt;
        type GoalId = Set<members::goal_id>;
        type Name = St::Name;
        type Year = St::Year;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetName<St> {}
    impl<St: State> State for SetName<St> {
        type CreatedAt = St::CreatedAt;
        type GoalId = St::GoalId;
        type Name = Set<members::name>;
        type Year = St::Year;
    }
    ///State transition - sets the `year` field to Set
    pub struct SetYear<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetYear<St> {}
    impl<St: State> State for SetYear<St> {
        type CreatedAt = St::CreatedAt;
        type GoalId = St::GoalId;
        type Name = St::Name;
        type Year = Set<members::year>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `goal_id` field
        pub struct goal_id(());
        ///Marker type for the `name` field
        pub struct name(());
        ///Marker type for the `year` field
        pub struct year(());
    }
}

/// Builder for constructing an instance of this type.
pub struct GoalBuilder<St: goal_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<Vec<S>>,
        Option<S>,
        Option<S>,
        Option<BlobRef<S>>,
        Option<UriValue<S>>,
        Option<Datetime>,
        Option<S>,
        Option<S>,
        Option<S>,
        Option<S>,
        Option<BlobRef<S>>,
        Option<UriValue<S>>,
        Option<i64>,
        Option<i64>,
    ),
    _type: PhantomData<fn() -> S>,
}

impl Goal<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> GoalBuilder<goal_state::Empty, DefaultStr> {
        GoalBuilder::new()
    }
}

impl<S: BosStr> Goal<S> {
    /// Create a new builder for this type
    pub fn builder() -> GoalBuilder<goal_state::Empty, S> {
        GoalBuilder::builder()
    }
}

impl GoalBuilder<goal_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        GoalBuilder {
            _state: PhantomData,
            _fields: (
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
            ),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr> GoalBuilder<goal_state::Empty, S> {
    /// Create a new builder with all fields unset
    pub fn builder() -> Self {
        GoalBuilder {
            _state: PhantomData,
            _fields: (
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
            ),
            _type: PhantomData,
        }
    }
}

impl<St: goal_state::State, S: BosStr> GoalBuilder<St, S> {
    /// Set the `accentColor` field (optional)
    pub fn accent_color(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `accentColor` field to an Option value (optional)
    pub fn maybe_accent_color(mut self, value: Option<S>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<St: goal_state::State, S: BosStr> GoalBuilder<St, S> {
    /// Set the `categories` field (optional)
    pub fn categories(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `categories` field to an Option value (optional)
    pub fn maybe_categories(mut self, value: Option<Vec<S>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St: goal_state::State, S: BosStr> GoalBuilder<St, S> {
    /// Set the `completedAccentColor` field (optional)
    pub fn completed_accent_color(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `completedAccentColor` field to an Option value (optional)
    pub fn maybe_completed_accent_color(mut self, value: Option<S>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St: goal_state::State, S: BosStr> GoalBuilder<St, S> {
    /// Set the `completedPiece` field (optional)
    pub fn completed_piece(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `completedPiece` field to an Option value (optional)
    pub fn maybe_completed_piece(mut self, value: Option<S>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St: goal_state::State, S: BosStr> GoalBuilder<St, S> {
    /// Set the `completedPieceBlob` field (optional)
    pub fn completed_piece_blob(mut self, value: impl Into<Option<BlobRef<S>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `completedPieceBlob` field to an Option value (optional)
    pub fn maybe_completed_piece_blob(mut self, value: Option<BlobRef<S>>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<St: goal_state::State, S: BosStr> GoalBuilder<St, S> {
    /// Set the `completedPieceUrl` field (optional)
    pub fn completed_piece_url(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `completedPieceUrl` field to an Option value (optional)
    pub fn maybe_completed_piece_url(mut self, value: Option<UriValue<S>>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St, S: BosStr> GoalBuilder<St, S>
where
    St: goal_state::State,
    St::CreatedAt: goal_state::IsUnset,
{
    /// Set the `createdAt` field (required)
    pub fn created_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> GoalBuilder<goal_state::SetCreatedAt<St>, S> {
        self._fields.6 = Option::Some(value.into());
        GoalBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: goal_state::State, S: BosStr> GoalBuilder<St, S> {
    /// Set the `description` field (optional)
    pub fn description(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `description` field to an Option value (optional)
    pub fn maybe_description(mut self, value: Option<S>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<St, S: BosStr> GoalBuilder<St, S>
where
    St: goal_state::State,
    St::GoalId: goal_state::IsUnset,
{
    /// Set the `goalId` field (required)
    pub fn goal_id(
        mut self,
        value: impl Into<S>,
    ) -> GoalBuilder<goal_state::SetGoalId<St>, S> {
        self._fields.8 = Option::Some(value.into());
        GoalBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> GoalBuilder<St, S>
where
    St: goal_state::State,
    St::Name: goal_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<S>,
    ) -> GoalBuilder<goal_state::SetName<St>, S> {
        self._fields.9 = Option::Some(value.into());
        GoalBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: goal_state::State, S: BosStr> GoalBuilder<St, S> {
    /// Set the `piece` field (optional)
    pub fn piece(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `piece` field to an Option value (optional)
    pub fn maybe_piece(mut self, value: Option<S>) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<St: goal_state::State, S: BosStr> GoalBuilder<St, S> {
    /// Set the `pieceBlob` field (optional)
    pub fn piece_blob(mut self, value: impl Into<Option<BlobRef<S>>>) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `pieceBlob` field to an Option value (optional)
    pub fn maybe_piece_blob(mut self, value: Option<BlobRef<S>>) -> Self {
        self._fields.11 = value;
        self
    }
}

impl<St: goal_state::State, S: BosStr> GoalBuilder<St, S> {
    /// Set the `pieceUrl` field (optional)
    pub fn piece_url(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
        self._fields.12 = value.into();
        self
    }
    /// Set the `pieceUrl` field to an Option value (optional)
    pub fn maybe_piece_url(mut self, value: Option<UriValue<S>>) -> Self {
        self._fields.12 = value;
        self
    }
}

impl<St: goal_state::State, S: BosStr> GoalBuilder<St, S> {
    /// Set the `targetCount` field (optional)
    pub fn target_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.13 = value.into();
        self
    }
    /// Set the `targetCount` field to an Option value (optional)
    pub fn maybe_target_count(mut self, value: Option<i64>) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<St, S: BosStr> GoalBuilder<St, S>
where
    St: goal_state::State,
    St::Year: goal_state::IsUnset,
{
    /// Set the `year` field (required)
    pub fn year(
        mut self,
        value: impl Into<i64>,
    ) -> GoalBuilder<goal_state::SetYear<St>, S> {
        self._fields.14 = Option::Some(value.into());
        GoalBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> GoalBuilder<St, S>
where
    St: goal_state::State,
    St::CreatedAt: goal_state::IsSet,
    St::GoalId: goal_state::IsSet,
    St::Name: goal_state::IsSet,
    St::Year: goal_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Goal<S> {
        Goal {
            accent_color: self._fields.0,
            categories: self._fields.1,
            completed_accent_color: self._fields.2,
            completed_piece: self._fields.3,
            completed_piece_blob: self._fields.4,
            completed_piece_url: self._fields.5,
            created_at: self._fields.6.unwrap(),
            description: self._fields.7,
            goal_id: self._fields.8.unwrap(),
            name: self._fields.9.unwrap(),
            piece: self._fields.10,
            piece_blob: self._fields.11,
            piece_url: self._fields.12,
            target_count: self._fields.13,
            year: self._fields.14.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Goal<S> {
        Goal {
            accent_color: self._fields.0,
            categories: self._fields.1,
            completed_accent_color: self._fields.2,
            completed_piece: self._fields.3,
            completed_piece_blob: self._fields.4,
            completed_piece_url: self._fields.5,
            created_at: self._fields.6.unwrap(),
            description: self._fields.7,
            goal_id: self._fields.8.unwrap(),
            name: self._fields.9.unwrap(),
            piece: self._fields.10,
            piece_blob: self._fields.11,
            piece_url: self._fields.12,
            target_count: self._fields.13,
            year: self._fields.14.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_garden_goals_goal() -> 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("garden.goals.goal"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    description: Some(
                        CowStr::new_static(
                            "A goal to track daily completions for a year.",
                        ),
                    ),
                    key: Some(CowStr::new_static("tid")),
                    record: LexRecordRecord::Object(LexObject {
                        required: Some(
                            vec![
                                SmolStr::new_static("goalId"), SmolStr::new_static("name"),
                                SmolStr::new_static("year"),
                                SmolStr::new_static("createdAt")
                            ],
                        ),
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("accentColor"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "Preset name or hex color for incomplete state",
                                        ),
                                    ),
                                    max_length: Some(50usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("categories"),
                                LexObjectProperty::Array(LexArray {
                                    description: Some(
                                        CowStr::new_static(
                                            "Array of category UUIDs this goal belongs to",
                                        ),
                                    ),
                                    items: LexArrayItem::String(LexString {
                                        max_length: Some(64usize),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("completedAccentColor"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "Preset name or hex color for complete state",
                                        ),
                                    ),
                                    max_length: Some(50usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("completedPiece"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Shape name or emoji for complete state"),
                                    ),
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("completedPieceBlob"),
                                LexObjectProperty::Blob(LexBlob { ..Default::default() }),
                            );
                            map.insert(
                                SmolStr::new_static("completedPieceUrl"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Favicon URL for complete state"),
                                    ),
                                    format: Some(LexStringFormat::Uri),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("createdAt"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Timestamp when the goal was created"),
                                    ),
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("description"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Optional description of the goal"),
                                    ),
                                    max_length: Some(500usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("goalId"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Unique identifier for the goal (UUID)"),
                                    ),
                                    max_length: Some(64usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("name"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Display name of the goal"),
                                    ),
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("piece"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "Shape name or emoji for incomplete state",
                                        ),
                                    ),
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("pieceBlob"),
                                LexObjectProperty::Blob(LexBlob { ..Default::default() }),
                            );
                            map.insert(
                                SmolStr::new_static("pieceUrl"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Favicon URL for incomplete state"),
                                    ),
                                    format: Some(LexStringFormat::Uri),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("targetCount"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("year"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1970i64),
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}