backbone-mail 0.2.32

Odoo mail core port — message/notification/followers/activity/alias/sms queue (schema: messaging)
//! Validator for FetchmailServer entity
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! Returns an `EntityValidator<FetchmailServer>` 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::FetchmailServer;

/// Validator type alias for FetchmailServer entities.
pub type FetchmailServerValidator = EntityValidator<FetchmailServer>;

/// Build a validator for FetchmailServer with all schema-defined field rules.
pub fn fetchmail_server_validator() -> FetchmailServerValidator {
    EntityValidator::new()
        .rule(RequiredString::new("name", |e: &FetchmailServer| &e.name))
        .rule(OptionalNotBlank::new("default_thread_model", |e: &FetchmailServer| e.default_thread_model.as_deref()))
        .rule(RequiredString::new("token_hash", |e: &FetchmailServer| &e.token_hash))
        .rule(OptionalNotBlank::new("error_message", |e: &FetchmailServer| e.error_message.as_deref()))
    // <<< CUSTOM RULES
    // END CUSTOM RULES
}

// <<< CUSTOM
// END CUSTOM