backbone-events 0.4.0

Events core + the sale/booth/crm/sms/desk overlay — registrations under one authoritative seat counter, the sale seam (order-minted registrations, forward-only paid heal, SO-cancel mirror cascade), booth bookings with the DB exclusivity wall, closed-vocabulary lead rules through a host sink port, the dual-channel (mail/sms) self-arming scheduler, and the exact-match desk verb (Odoo event port, core + overlay)
//! DTOs (Data Transfer Objects)
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! This module provides DTOs for the presentation layer,
//! with validation and OpenAPI schema support.

pub mod booth_category_dto;
pub mod booth_dto;
pub mod type_booth_dto;
pub mod booth_booking_dto;
pub mod event_dto;
pub mod event_type_dto;
pub mod lead_provenance_dto;
pub mod lead_provenance_registration_dto;
pub mod lead_request_dto;
pub mod lead_rule_dto;
pub mod lead_rule_predicate_dto;
pub mod mail_dto;
pub mod mail_registration_dto;
pub mod mail_slot_dto;
pub mod question_dto;
pub mod question_answer_dto;
pub mod registration_question_dto;
pub mod registration_dto;
pub mod registration_answer_dto;
pub mod slot_dto;
pub mod stage_dto;
pub mod tag_category_dto;
pub mod tag_dto;
pub mod ticket_dto;
pub mod type_mail_dto;

// Re-exports
pub use booth_category_dto::{
    CreateBoothCategoryDto,
    UpdateBoothCategoryDto,
    PatchBoothCategoryDto,
    BoothCategoryResponseDto,
    BoothCategoryListResponseDto,
    BoothCategorySummaryDto,
};
pub use booth_dto::{
    CreateBoothDto,
    UpdateBoothDto,
    PatchBoothDto,
    BoothResponseDto,
    BoothListResponseDto,
    BoothSummaryDto,
};
pub use type_booth_dto::{
    CreateTypeBoothDto,
    UpdateTypeBoothDto,
    PatchTypeBoothDto,
    TypeBoothResponseDto,
    TypeBoothListResponseDto,
    TypeBoothSummaryDto,
};
pub use booth_booking_dto::{
    CreateBoothBookingDto,
    UpdateBoothBookingDto,
    PatchBoothBookingDto,
    BoothBookingResponseDto,
    BoothBookingListResponseDto,
    BoothBookingSummaryDto,
};
pub use event_dto::{
    CreateEventDto,
    UpdateEventDto,
    PatchEventDto,
    EventResponseDto,
    EventListResponseDto,
    EventSummaryDto,
};
pub use event_type_dto::{
    CreateEventTypeDto,
    UpdateEventTypeDto,
    PatchEventTypeDto,
    EventTypeResponseDto,
    EventTypeListResponseDto,
    EventTypeSummaryDto,
};
pub use lead_provenance_dto::{
    CreateLeadProvenanceDto,
    UpdateLeadProvenanceDto,
    PatchLeadProvenanceDto,
    LeadProvenanceResponseDto,
    LeadProvenanceListResponseDto,
    LeadProvenanceSummaryDto,
};
pub use lead_provenance_registration_dto::{
    CreateLeadProvenanceRegistrationDto,
    UpdateLeadProvenanceRegistrationDto,
    PatchLeadProvenanceRegistrationDto,
    LeadProvenanceRegistrationResponseDto,
    LeadProvenanceRegistrationListResponseDto,
    LeadProvenanceRegistrationSummaryDto,
};
pub use lead_request_dto::{
    CreateLeadRequestDto,
    UpdateLeadRequestDto,
    PatchLeadRequestDto,
    LeadRequestResponseDto,
    LeadRequestListResponseDto,
    LeadRequestSummaryDto,
};
pub use lead_rule_dto::{
    CreateLeadRuleDto,
    UpdateLeadRuleDto,
    PatchLeadRuleDto,
    LeadRuleResponseDto,
    LeadRuleListResponseDto,
    LeadRuleSummaryDto,
};
pub use lead_rule_predicate_dto::{
    CreateLeadRulePredicateDto,
    UpdateLeadRulePredicateDto,
    PatchLeadRulePredicateDto,
    LeadRulePredicateResponseDto,
    LeadRulePredicateListResponseDto,
    LeadRulePredicateSummaryDto,
};
pub use mail_dto::{
    CreateMailDto,
    UpdateMailDto,
    PatchMailDto,
    MailResponseDto,
    MailListResponseDto,
    MailSummaryDto,
};
pub use mail_registration_dto::{
    CreateMailRegistrationDto,
    UpdateMailRegistrationDto,
    PatchMailRegistrationDto,
    MailRegistrationResponseDto,
    MailRegistrationListResponseDto,
    MailRegistrationSummaryDto,
};
pub use mail_slot_dto::{
    CreateMailSlotDto,
    UpdateMailSlotDto,
    PatchMailSlotDto,
    MailSlotResponseDto,
    MailSlotListResponseDto,
    MailSlotSummaryDto,
};
pub use question_dto::{
    CreateQuestionDto,
    UpdateQuestionDto,
    PatchQuestionDto,
    QuestionResponseDto,
    QuestionListResponseDto,
    QuestionSummaryDto,
};
pub use question_answer_dto::{
    CreateQuestionAnswerDto,
    UpdateQuestionAnswerDto,
    PatchQuestionAnswerDto,
    QuestionAnswerResponseDto,
    QuestionAnswerListResponseDto,
    QuestionAnswerSummaryDto,
};
pub use registration_question_dto::{
    CreateRegistrationQuestionDto,
    UpdateRegistrationQuestionDto,
    PatchRegistrationQuestionDto,
    RegistrationQuestionResponseDto,
    RegistrationQuestionListResponseDto,
    RegistrationQuestionSummaryDto,
};
pub use registration_dto::{
    CreateRegistrationDto,
    UpdateRegistrationDto,
    PatchRegistrationDto,
    RegistrationResponseDto,
    RegistrationListResponseDto,
    RegistrationSummaryDto,
};
pub use registration_answer_dto::{
    CreateRegistrationAnswerDto,
    UpdateRegistrationAnswerDto,
    PatchRegistrationAnswerDto,
    RegistrationAnswerResponseDto,
    RegistrationAnswerListResponseDto,
    RegistrationAnswerSummaryDto,
};
pub use slot_dto::{
    CreateSlotDto,
    UpdateSlotDto,
    PatchSlotDto,
    SlotResponseDto,
    SlotListResponseDto,
    SlotSummaryDto,
};
pub use stage_dto::{
    CreateStageDto,
    UpdateStageDto,
    PatchStageDto,
    StageResponseDto,
    StageListResponseDto,
    StageSummaryDto,
};
pub use tag_category_dto::{
    CreateTagCategoryDto,
    UpdateTagCategoryDto,
    PatchTagCategoryDto,
    TagCategoryResponseDto,
    TagCategoryListResponseDto,
    TagCategorySummaryDto,
};
pub use tag_dto::{
    CreateTagDto,
    UpdateTagDto,
    PatchTagDto,
    TagResponseDto,
    TagListResponseDto,
    TagSummaryDto,
};
pub use ticket_dto::{
    CreateTicketDto,
    UpdateTicketDto,
    PatchTicketDto,
    TicketResponseDto,
    TicketListResponseDto,
    TicketSummaryDto,
};
pub use type_mail_dto::{
    CreateTypeMailDto,
    UpdateTypeMailDto,
    PatchTypeMailDto,
    TypeMailResponseDto,
    TypeMailListResponseDto,
    TypeMailSummaryDto,
};

// Common pagination types
use serde::Serialize;

#[cfg(feature = "openapi")]
#[cfg(feature = "openapi")]
use utoipa::ToSchema;

/// Pagination parameters for list requests
#[derive(Debug, Clone, Default, serde::Deserialize)]
#[cfg_attr(feature = "openapi", derive(ToSchema))]
pub struct PaginationParams {
    /// Page number (1-indexed)
    #[serde(default = "default_page")]
    pub page: u32,
    /// Items per page
    #[serde(default = "default_per_page")]
    pub per_page: u32,
    /// Field to sort by
    pub sort_by: Option<String>,
    /// Sort order (asc/desc)
    pub sort_order: Option<String>,
}

fn default_page() -> u32 { 1 }
fn default_per_page() -> u32 { 20 }

/// API response wrapper
#[derive(Debug, Clone, Serialize)]
#[cfg_attr(feature = "openapi", derive(ToSchema))]
#[serde(rename_all = "camelCase")]
pub struct ApiResponse<T> {
    pub success: bool,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub data: Option<T>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub error: Option<ApiError>,
}

#[derive(Debug, Clone, Serialize)]
#[cfg_attr(feature = "openapi", derive(ToSchema))]
pub struct ApiError {
    pub code: String,
    pub message: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub details: Option<serde_json::Value>,
}

impl<T> ApiResponse<T> {
    pub fn ok(data: T) -> Self {
        Self { success: true, data: Some(data), error: None }
    }

    pub fn err(code: impl Into<String>, message: impl Into<String>) -> Self {
        Self {
            success: false,
            data: None,
            error: Some(ApiError {
                code: code.into(),
                message: message.into(),
                details: None,
            }),
        }
    }
}