// @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, 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::string::Datetime;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
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;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetAssignmentOutput<S: BosStr = DefaultStr> {
    ///Active plan assignment (null if no active plan)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub assignment: Option<get_assignment::PlanAssignment<S>>,
    ///Response message
    #[serde(skip_serializing_if = "Option::is_none")]
    pub message: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Plan assignment details.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct PlanAssignment<S: BosStr = DefaultStr> {
    ///Plan activation timestamp
    pub activated_at: Datetime,
    ///Plan expiration timestamp
    pub expires_at: Datetime,
    ///Plan assignment ID
    pub id: S,
    pub plan: get_assignment::PlanInfo<S>,
    ///Plan ID
    pub plan_id: S,
    ///Plan assignment status
    pub status: S,
    ///Ticket information (if redeemed from ticket)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ticket: Option<get_assignment::TicketInfo<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Plan information.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct PlanInfo<S: BosStr = DefaultStr> {
    ///Plan description
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<S>,
    ///Plan ID
    pub id: S,
    ///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
    pub name: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Ticket information.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct TicketInfo<S: BosStr = DefaultStr> {
    ///Ticket code
    pub code: S,
    ///Ticket ID
    pub id: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/** Request marker for the `app.chronosky.plan.getAssignment` query.

This endpoint has no request parameters or input body; send this marker with `jacquard::Client`.*/

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Copy)]
pub struct GetAssignment;
/** Response marker for the `app.chronosky.plan.getAssignment` query.

Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `GetAssignmentOutput<S>` for this endpoint.*/
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<S: BosStr> = GetAssignmentOutput<S>;
    type Err = jacquard_common::xrpc::GenericError;
}

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 marker for the `app.chronosky.plan.getAssignment` query.

Path: `/xrpc/app.chronosky.plan.getAssignment`. The request payload type is `GetAssignment`; use this marker with lower-level `XrpcEndpoint` APIs when you need endpoint metadata.*/
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<S: BosStr> = GetAssignment;
    type Response = GetAssignmentResponse;
}

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

/// Builder for constructing an instance of this type.
pub struct PlanAssignmentBuilder<
    St: plan_assignment_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Datetime>,
        Option<Datetime>,
        Option<S>,
        Option<get_assignment::PlanInfo<S>>,
        Option<S>,
        Option<S>,
        Option<get_assignment::TicketInfo<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

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

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

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

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

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

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

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

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

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

impl<St: plan_assignment_state::State, S: BosStr> PlanAssignmentBuilder<St, S> {
    /// Set the `ticket` field (optional)
    pub fn ticket(
        mut self,
        value: impl Into<Option<get_assignment::TicketInfo<S>>>,
    ) -> 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<S>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St, S: BosStr> PlanAssignmentBuilder<St, S>
where
    St: plan_assignment_state::State,
    St::ActivatedAt: plan_assignment_state::IsSet,
    St::ExpiresAt: plan_assignment_state::IsSet,
    St::Id: plan_assignment_state::IsSet,
    St::Plan: plan_assignment_state::IsSet,
    St::PlanId: plan_assignment_state::IsSet,
    St::Status: plan_assignment_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> PlanAssignment<S> {
        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<SmolStr, Data<S>>,
    ) -> PlanAssignment<S> {
        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()
    }
}