use backbone_core::{EntityValidator, ValidationErrors, ValidationError};
use backbone_core::{NonNegative, RequiredString};
use crate::domain::entity::UserQuota;
pub type UserQuotaValidator = EntityValidator<UserQuota>;
pub fn user_quota_validator() -> UserQuotaValidator {
EntityValidator::new()
.rule(NonNegative::new("limit_bytes", |e: &UserQuota| e.limit_bytes))
.rule(NonNegative::new("used_bytes", |e: &UserQuota| e.used_bytes))
.rule(NonNegative::new("file_count", |e: &UserQuota| e.file_count as i64))
.rule(RequiredString::new("tier", |e: &UserQuota| &e.tier))
.rule(NonNegative::new("peak_usage_bytes", |e: &UserQuota| e.peak_usage_bytes))
}