//! Single source of truth for role_key <-> display name / profile table mappings,
//! shared by profile.rs, verifications.rs and approvals.rs so a role added to one
//! consumer can't silently be missing from another.

pub fn role_key_to_display(role_key: &str) -> String {
    match role_key.to_uppercase().as_str() {
        "COMPANY" => "Company".to_string(),
        "CUSTOMER" => "Customer".to_string(),
        "JOB_SEEKER" | "JOBSEEKER" => "Job Seeker".to_string(),
        "PHOTOGRAPHER" => "Photographer".to_string(),
        "MAKEUP_ARTIST" => "Makeup Artist".to_string(),
        "TUTOR" => "Tutor".to_string(),
        "DEVELOPER" => "Developer".to_string(),
        "VIDEO_EDITOR" => "Video Editor".to_string(),
        "GRAPHIC_DESIGNER" => "Graphic Designer".to_string(),
        "SOCIAL_MEDIA_MANAGER" => "Social Media Manager".to_string(),
        "FITNESS_TRAINER" => "Fitness Trainer".to_string(),
        "CATERING_SERVICES" => "Catering Services".to_string(),
        "UGC_CONTENT_CREATOR" => "UGC Content Creator".to_string(),
        _ => role_key.to_string(),
    }
}

/// Returns the profile table for a role, or None for roles with no dedicated
/// profile table under this pipeline (e.g. COMPANY, which is handled separately).
pub fn role_to_table(role_key: &str) -> Option<&'static str> {
    match role_key.to_uppercase().as_str() {
        "PHOTOGRAPHER" => Some("photographer_profiles"),
        "MAKEUP_ARTIST" => Some("makeup_artist_profiles"),
        "TUTOR" => Some("tutor_profiles"),
        "DEVELOPER" => Some("developer_profiles"),
        "VIDEO_EDITOR" => Some("video_editor_profiles"),
        "GRAPHIC_DESIGNER" => Some("graphic_designer_profiles"),
        "SOCIAL_MEDIA_MANAGER" => Some("social_media_manager_profiles"),
        "FITNESS_TRAINER" => Some("fitness_trainer_profiles"),
        "CATERING_SERVICES" => Some("catering_service_profiles"),
        "UGC_CONTENT_CREATOR" => Some("ugc_content_creator_profiles"),
        "JOB_SEEKER" | "JOBSEEKER" => Some("job_seeker_profiles"),
        "CUSTOMER" => Some("customer_profiles"),
        "COMPANY" => Some("company_profiles"),
        _ => None,
    }
}
