reputation-types 0.1.0

Core types and data structures for the KnowThat Reputation Engine
Documentation
use reputation_types::{AgentData, AgentDataBuilder};
use chrono::{Duration, Utc};

fn main() {
    // Example 1: Simple agent with minimal data
    let simple_agent = AgentDataBuilder::new("did:example:simple123")
        .build()
        .expect("Failed to build simple agent");
    
    println!("Simple Agent: {:?}", simple_agent);
    println!();

    // Example 2: Agent with reviews using the convenience method
    let reviewed_agent = AgentDataBuilder::new("did:example:reviewed456")
        .with_reviews(100, 4.5)
        .mcp_level(2)
        .identity_verified(true)
        .build()
        .expect("Failed to build reviewed agent");
    
    println!("Reviewed Agent:");
    println!("  DID: {}", reviewed_agent.did);
    println!("  Total Reviews: {}", reviewed_agent.total_reviews);
    println!("  Average Rating: {:?}", reviewed_agent.average_rating);
    println!("  Positive Reviews: {}", reviewed_agent.positive_reviews);
    println!("  Negative Reviews: {}", reviewed_agent.negative_reviews);
    println!();

    // Example 3: Fully configured agent
    let full_agent = AgentData::builder("did:example:full789")
        .created_at(Utc::now() - Duration::days(365))
        .mcp_level(3)
        .identity_verified(true)
        .security_audit_passed(true)
        .open_source(true)
        .total_interactions(5000)
        .positive_reviews(950)
        .negative_reviews(50)
        .build()
        .expect("Failed to build full agent");
    
    println!("Full Agent:");
    println!("  DID: {}", full_agent.did);
    println!("  Created: {} days ago", 
        (Utc::now() - full_agent.created_at).num_days());
    println!("  MCP Level: {:?}", full_agent.mcp_level);
    println!("  Identity Verified: {}", full_agent.identity_verified);
    println!("  Security Audit: {}", full_agent.security_audit_passed);
    println!("  Open Source: {}", full_agent.open_source);
    println!("  Total Interactions: {}", full_agent.total_interactions);
    println!("  Total Reviews: {}", full_agent.total_reviews);
    println!("  Average Rating: {:?}", full_agent.average_rating);
    println!();

    // Example 4: Error handling
    match AgentDataBuilder::new("").build() {
        Ok(_) => println!("This shouldn't happen!"),
        Err(e) => println!("Expected error for empty DID: {}", e),
    }

    match AgentDataBuilder::new("did:example:invalid")
        .average_rating(6.0)
        .build() {
        Ok(_) => println!("This shouldn't happen!"),
        Err(e) => println!("Expected error for invalid rating: {}", e),
    }
}