use anyhow::{Result, anyhow};
use crate::ConversionJob;
pub struct ConversionJobDomainService;
impl ConversionJobDomainService {
pub fn new() -> Self {
Self
}
pub fn validate(&self, entity: &ConversionJob) -> Result<()> {
if entity.target_format.is_empty() {
return Err(anyhow!("target_format is required"));
}
Ok(())
}
pub fn can_create(&self, entity: &ConversionJob) -> Result<bool> {
self.validate(entity)?;
Ok(true)
}
pub fn can_update(&self, _current: &ConversionJob, _updated: &ConversionJob) -> Result<bool> {
Ok(true)
}
pub fn can_delete(&self, _entity: &ConversionJob) -> Result<bool> {
Ok(true)
}
}
impl Default for ConversionJobDomainService {
fn default() -> Self {
Self::new()
}
}