use marketing_engine::*;
use uuid::Uuid;

#[tokio::test]
async fn test_content_lifecycle() -> Result<(), MarketingError> {
    let campaign_id = Uuid::new_v4();
    
    // Создаем и валидируем контент
    let content = Content::new(campaign_id, "Тестовый пост")
        .validate(0.85)?;
    
    assert_eq!(content.state, ContentState::Validated);
    assert_eq!(content.engagement_potential, Some(0.85));
    
    // Публикуем
    let content = content.publish("https://test.com/post")?;
    
    assert_eq!(content.state, ContentState::Published);
    assert_eq!(content.leads_generated, Some(8));
    assert!(content.get_roi() > 0.0);
    
    Ok(())
}

#[tokio::test]
async fn test_invalid_engagement() {
    let campaign_id = Uuid::new_v4();
    let result = Content::new(campaign_id, "Плохой пост").validate(0.3);
    
    assert!(result.is_err());
    match result {
        Err(MarketingError::LowEngagement(value)) => {
            assert_eq!(value, 0.3);
        }
        _ => panic!("Должна быть ошибка LowEngagement"),
    }
}
