// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: app.chronosky.plan.getAssignment
//
// 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::string::Datetime;
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};
use crate::app_chronosky::plan::get_assignment;

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetAssignmentOutput<'a> {
    ///Active plan assignment (null if no active plan)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub assignment: Option<get_assignment::PlanAssignment<'a>>,
    ///Response message
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub message: Option<CowStr<'a>>,
}

/// Plan assignment details.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct PlanAssignment<'a> {
    ///Plan activation timestamp
    pub activated_at: Datetime,
    ///Plan expiration timestamp
    pub expires_at: Datetime,
    ///Plan assignment ID
    #[serde(borrow)]
    pub id: CowStr<'a>,
    #[serde(borrow)]
    pub plan: get_assignment::PlanInfo<'a>,
    ///Plan ID
    #[serde(borrow)]
    pub plan_id: CowStr<'a>,
    ///Plan assignment status
    #[serde(borrow)]
    pub status: CowStr<'a>,
    ///Ticket information (if redeemed from ticket)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub ticket: Option<get_assignment::TicketInfo<'a>>,
}

/// Plan information.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct PlanInfo<'a> {
    ///Plan description
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub description: Option<CowStr<'a>>,
    ///Plan ID
    #[serde(borrow)]
    pub id: CowStr<'a>,
    ///Maximum concurrent posts
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_concurrent_posts: Option<i64>,
    ///Maximum images per post
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_images_per_post: Option<i64>,
    ///Maximum posts per day
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_posts_per_day: Option<i64>,
    ///Maximum days to schedule in advance
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_schedule_days: Option<i64>,
    ///Maximum posts per thread
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_thread_posts: Option<i64>,
    ///Minimum interval between posts (minutes)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub min_schedule_interval: Option<i64>,
    ///Plan name
    #[serde(borrow)]
    pub name: CowStr<'a>,
}

/// Ticket information.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct TicketInfo<'a> {
    ///Ticket code
    #[serde(borrow)]
    pub code: CowStr<'a>,
    ///Ticket ID
    #[serde(borrow)]
    pub id: CowStr<'a>,
}

/// XRPC request marker type.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Copy)]
pub struct GetAssignment;
/// Response type for app.chronosky.plan.getAssignment
pub struct GetAssignmentResponse;
impl jacquard_common::xrpc::XrpcResp for GetAssignmentResponse {
    const NSID: &'static str = "app.chronosky.plan.getAssignment";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = GetAssignmentOutput<'de>;
    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}

impl jacquard_common::xrpc::XrpcRequest for GetAssignment {
    const NSID: &'static str = "app.chronosky.plan.getAssignment";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Response = GetAssignmentResponse;
}

/// Endpoint type for app.chronosky.plan.getAssignment
pub struct GetAssignmentRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetAssignmentRequest {
    const PATH: &'static str = "/xrpc/app.chronosky.plan.getAssignment";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Request<'de> = GetAssignment;
    type Response = GetAssignmentResponse;
}

impl<'a> LexiconSchema for PlanAssignment<'a> {
    fn nsid() -> &'static str {
        "app.chronosky.plan.getAssignment"
    }
    fn def_name() -> &'static str {
        "planAssignment"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_chronosky_plan_getAssignment()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.id;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("id"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.plan_id;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("plan_id"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.status;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("status"),
                    max: 20usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<'a> LexiconSchema for PlanInfo<'a> {
    fn nsid() -> &'static str {
        "app.chronosky.plan.getAssignment"
    }
    fn def_name() -> &'static str {
        "planInfo"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_chronosky_plan_getAssignment()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.description {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 1000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("description"),
                    max: 1000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.id;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("id"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.name;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 200usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("name"),
                    max: 200usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<'a> LexiconSchema for TicketInfo<'a> {
    fn nsid() -> &'static str {
        "app.chronosky.plan.getAssignment"
    }
    fn def_name() -> &'static str {
        "ticketInfo"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_chronosky_plan_getAssignment()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.code;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("code"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.id;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("id"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

pub mod plan_assignment_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 Status;
        type Id;
        type PlanId;
        type Plan;
        type ActivatedAt;
        type ExpiresAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Status = Unset;
        type Id = Unset;
        type PlanId = Unset;
        type Plan = Unset;
        type ActivatedAt = Unset;
        type ExpiresAt = Unset;
    }
    ///State transition - sets the `status` field to Set
    pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetStatus<S> {}
    impl<S: State> State for SetStatus<S> {
        type Status = Set<members::status>;
        type Id = S::Id;
        type PlanId = S::PlanId;
        type Plan = S::Plan;
        type ActivatedAt = S::ActivatedAt;
        type ExpiresAt = S::ExpiresAt;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetId<S> {}
    impl<S: State> State for SetId<S> {
        type Status = S::Status;
        type Id = Set<members::id>;
        type PlanId = S::PlanId;
        type Plan = S::Plan;
        type ActivatedAt = S::ActivatedAt;
        type ExpiresAt = S::ExpiresAt;
    }
    ///State transition - sets the `plan_id` field to Set
    pub struct SetPlanId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetPlanId<S> {}
    impl<S: State> State for SetPlanId<S> {
        type Status = S::Status;
        type Id = S::Id;
        type PlanId = Set<members::plan_id>;
        type Plan = S::Plan;
        type ActivatedAt = S::ActivatedAt;
        type ExpiresAt = S::ExpiresAt;
    }
    ///State transition - sets the `plan` field to Set
    pub struct SetPlan<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetPlan<S> {}
    impl<S: State> State for SetPlan<S> {
        type Status = S::Status;
        type Id = S::Id;
        type PlanId = S::PlanId;
        type Plan = Set<members::plan>;
        type ActivatedAt = S::ActivatedAt;
        type ExpiresAt = S::ExpiresAt;
    }
    ///State transition - sets the `activated_at` field to Set
    pub struct SetActivatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetActivatedAt<S> {}
    impl<S: State> State for SetActivatedAt<S> {
        type Status = S::Status;
        type Id = S::Id;
        type PlanId = S::PlanId;
        type Plan = S::Plan;
        type ActivatedAt = Set<members::activated_at>;
        type ExpiresAt = S::ExpiresAt;
    }
    ///State transition - sets the `expires_at` field to Set
    pub struct SetExpiresAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetExpiresAt<S> {}
    impl<S: State> State for SetExpiresAt<S> {
        type Status = S::Status;
        type Id = S::Id;
        type PlanId = S::PlanId;
        type Plan = S::Plan;
        type ActivatedAt = S::ActivatedAt;
        type ExpiresAt = Set<members::expires_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `status` field
        pub struct status(());
        ///Marker type for the `id` field
        pub struct id(());
        ///Marker type for the `plan_id` field
        pub struct plan_id(());
        ///Marker type for the `plan` field
        pub struct plan(());
        ///Marker type for the `activated_at` field
        pub struct activated_at(());
        ///Marker type for the `expires_at` field
        pub struct expires_at(());
    }
}

/// Builder for constructing an instance of this type
pub struct PlanAssignmentBuilder<'a, S: plan_assignment_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<Datetime>,
        Option<Datetime>,
        Option<CowStr<'a>>,
        Option<get_assignment::PlanInfo<'a>>,
        Option<CowStr<'a>>,
        Option<CowStr<'a>>,
        Option<get_assignment::TicketInfo<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> PlanAssignment<'a> {
    /// Create a new builder for this type
    pub fn new() -> PlanAssignmentBuilder<'a, plan_assignment_state::Empty> {
        PlanAssignmentBuilder::new()
    }
}

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

impl<'a, S> PlanAssignmentBuilder<'a, S>
where
    S: plan_assignment_state::State,
    S::ActivatedAt: plan_assignment_state::IsUnset,
{
    /// Set the `activatedAt` field (required)
    pub fn activated_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> PlanAssignmentBuilder<'a, plan_assignment_state::SetActivatedAt<S>> {
        self._fields.0 = Option::Some(value.into());
        PlanAssignmentBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PlanAssignmentBuilder<'a, S>
where
    S: plan_assignment_state::State,
    S::ExpiresAt: plan_assignment_state::IsUnset,
{
    /// Set the `expiresAt` field (required)
    pub fn expires_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> PlanAssignmentBuilder<'a, plan_assignment_state::SetExpiresAt<S>> {
        self._fields.1 = Option::Some(value.into());
        PlanAssignmentBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PlanAssignmentBuilder<'a, S>
where
    S: plan_assignment_state::State,
    S::Id: plan_assignment_state::IsUnset,
{
    /// Set the `id` field (required)
    pub fn id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> PlanAssignmentBuilder<'a, plan_assignment_state::SetId<S>> {
        self._fields.2 = Option::Some(value.into());
        PlanAssignmentBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PlanAssignmentBuilder<'a, S>
where
    S: plan_assignment_state::State,
    S::Plan: plan_assignment_state::IsUnset,
{
    /// Set the `plan` field (required)
    pub fn plan(
        mut self,
        value: impl Into<get_assignment::PlanInfo<'a>>,
    ) -> PlanAssignmentBuilder<'a, plan_assignment_state::SetPlan<S>> {
        self._fields.3 = Option::Some(value.into());
        PlanAssignmentBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PlanAssignmentBuilder<'a, S>
where
    S: plan_assignment_state::State,
    S::PlanId: plan_assignment_state::IsUnset,
{
    /// Set the `planId` field (required)
    pub fn plan_id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> PlanAssignmentBuilder<'a, plan_assignment_state::SetPlanId<S>> {
        self._fields.4 = Option::Some(value.into());
        PlanAssignmentBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PlanAssignmentBuilder<'a, S>
where
    S: plan_assignment_state::State,
    S::Status: plan_assignment_state::IsUnset,
{
    /// Set the `status` field (required)
    pub fn status(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> PlanAssignmentBuilder<'a, plan_assignment_state::SetStatus<S>> {
        self._fields.5 = Option::Some(value.into());
        PlanAssignmentBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: plan_assignment_state::State> PlanAssignmentBuilder<'a, S> {
    /// Set the `ticket` field (optional)
    pub fn ticket(
        mut self,
        value: impl Into<Option<get_assignment::TicketInfo<'a>>>,
    ) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `ticket` field to an Option value (optional)
    pub fn maybe_ticket(
        mut self,
        value: Option<get_assignment::TicketInfo<'a>>,
    ) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<'a, S> PlanAssignmentBuilder<'a, S>
where
    S: plan_assignment_state::State,
    S::Status: plan_assignment_state::IsSet,
    S::Id: plan_assignment_state::IsSet,
    S::PlanId: plan_assignment_state::IsSet,
    S::Plan: plan_assignment_state::IsSet,
    S::ActivatedAt: plan_assignment_state::IsSet,
    S::ExpiresAt: plan_assignment_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> PlanAssignment<'a> {
        PlanAssignment {
            activated_at: self._fields.0.unwrap(),
            expires_at: self._fields.1.unwrap(),
            id: self._fields.2.unwrap(),
            plan: self._fields.3.unwrap(),
            plan_id: self._fields.4.unwrap(),
            status: self._fields.5.unwrap(),
            ticket: self._fields.6,
            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>,
        >,
    ) -> PlanAssignment<'a> {
        PlanAssignment {
            activated_at: self._fields.0.unwrap(),
            expires_at: self._fields.1.unwrap(),
            id: self._fields.2.unwrap(),
            plan: self._fields.3.unwrap(),
            plan_id: self._fields.4.unwrap(),
            status: self._fields.5.unwrap(),
            ticket: self._fields.6,
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_app_chronosky_plan_getAssignment() -> 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("app.chronosky.plan.getAssignment"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::XrpcQuery(LexXrpcQuery {
                    parameters: None,
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("planAssignment"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Plan assignment details.")),
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("planId"),
                            SmolStr::new_static("plan"),
                            SmolStr::new_static("activatedAt"),
                            SmolStr::new_static("expiresAt"),
                            SmolStr::new_static("status")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("activatedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Plan activation timestamp"),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("expiresAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Plan expiration timestamp"),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Plan assignment ID")),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("plan"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#planInfo"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("planId"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Plan ID")),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Plan assignment status"),
                                ),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("ticket"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#ticketInfo"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("planInfo"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Plan information.")),
                    required: Some(
                        vec![SmolStr::new_static("id"), SmolStr::new_static("name")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("description"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Plan description")),
                                max_length: Some(1000usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Plan ID")),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("maxConcurrentPosts"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("maxImagesPerPost"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("maxPostsPerDay"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("maxScheduleDays"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("maxThreadPosts"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("minScheduleInterval"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Plan name")),
                                max_length: Some(200usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("ticketInfo"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Ticket information.")),
                    required: Some(
                        vec![SmolStr::new_static("id"), SmolStr::new_static("code")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("code"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Ticket code")),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Ticket ID")),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}