backbone-inventory 0.10.1

Inventory: stock ledger of record (SLE) + moving-average valuation; emits COGS/asset AccountingPost (Delivery/Receipt -> GL)
Documentation
//! Validator for Lot entity
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! Returns an `EntityValidator<Lot>` pre-loaded with schema-derived
//! field rules. Extend in the `// <<< CUSTOM` zone.

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

/// Validator type alias for Lot entities.
pub type LotValidator = EntityValidator<Lot>;

/// Build a validator for Lot with all schema-defined field rules.
pub fn lot_validator() -> LotValidator {
    EntityValidator::new()
        .rule(RequiredString::new("name", |e: &Lot| &e.name))
        .rule(OptionalNotBlank::new("reference", |e: &Lot| e.reference.as_deref()))
        .rule(OptionalNotBlank::new("note", |e: &Lot| e.note.as_deref()))
    // <<< CUSTOM RULES
    // END CUSTOM RULES
}

// <<< CUSTOM
// END CUSTOM