pub mod dashboard;
pub mod gameday;
pub mod lineup;
pub mod matchup;
pub mod roster;
pub mod settings;
pub mod standings;

pub fn format_relative_time(dt: &chrono::NaiveDateTime) -> String {
    let now = chrono::Utc::now().naive_utc();
    let secs = now.signed_duration_since(*dt).num_seconds();
    if secs < 60 {
        return "just now".to_string();
    }
    let mins = secs / 60;
    if mins < 60 {
        return format!("{}m ago", mins);
    }
    let hours = mins / 60;
    if hours < 24 {
        return format!("{}h ago", hours);
    }
    format!("{}d ago", hours / 24)
}

pub fn tier_style(tier: &str) -> ratatui::style::Style {
    use ratatui::style::{Color, Style};
    match tier {
        "A" => Style::default().fg(Color::Green),
        "B" => Style::default().fg(Color::LightGreen),
        "C" => Style::default().fg(Color::Yellow),
        "D" => Style::default().fg(Color::LightRed),
        "F" => Style::default().fg(Color::Red),
        _ => Style::default().fg(Color::DarkGray),
    }
}
