backbone-events 0.5.4

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)
//! Validator for Event entity
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! Returns an `EntityValidator<Event>` pre-loaded with schema-derived
//! field rules. Extend in the `// <<< CUSTOM` zone.

use backbone_core::{EntityValidator, ValidationErrors, ValidationError};
use backbone_core::{NonNegative, OptionalNotBlank, RequiredString};
use crate::domain::entity::Event;

/// Validator type alias for Event entities.
pub type EventValidator = EntityValidator<Event>;

/// Build a validator for Event with all schema-defined field rules.
pub fn event_validator() -> EventValidator {
    let validator = EntityValidator::new()
        .rule(RequiredString::new("name", |e: &Event| &e.name))
        .rule(RequiredString::new("date_tz", |e: &Event| &e.date_tz))
        .rule(NonNegative::new("seats_max", |e: &Event| e.seats_max as i64))
        .rule(OptionalNotBlank::new("event_url", |e: &Event| e.event_url.as_deref()))
    ;
    event_validator_ext::extend(validator)
}


// This file's extension (hand-written; ADR-0031).
#[path = "event_validator.ext.rs"]
mod event_validator_ext;
pub use event_validator_ext::*;