// Stage-specific quick actions config mapped by stage type

export type ActionType =
    | "view_resume"
    | "advance_stage"
    | "quick_reject"
    | "schedule_call"
    | "schedule_interview"
    | "send_assessment"
    | "add_score"
    | "add_note"
    | "generate_offer"
    | "send_message"
    | "view_profile";

export interface StageAction {
    id: ActionType;
    label: string;
    icon: string; // lucide icon name
    variant: "primary" | "secondary" | "danger" | "ghost";
    description: string;
}

export const STAGE_ACTIONS: Record<string, { primary: StageAction; secondary: StageAction[] }> = {
    applied: {
        primary: { id: "view_resume", label: "View Resume", icon: "FileText", variant: "primary", description: "Open candidate resume in a preview panel" },
        secondary: [
            { id: "advance_stage", label: "Advance to Screen", icon: "ChevronRight", variant: "secondary", description: "Move candidate to the next stage" },
            { id: "add_score", label: "Add AI Score", icon: "Sparkles", variant: "secondary", description: "Run AI match scoring for this candidate" },
            { id: "send_message", label: "Send Message", icon: "MessageSquare", variant: "ghost", description: "Start a conversation" },
            { id: "quick_reject", label: "Quick Reject", icon: "X", variant: "danger", description: "Reject with a reason" },
        ],
    },
    screening: {
        primary: { id: "schedule_call", label: "Schedule Call", icon: "Phone", variant: "primary", description: "Schedule a phone screening call" },
        secondary: [
            { id: "advance_stage", label: "Advance", icon: "ChevronRight", variant: "secondary", description: "Move to next stage" },
            { id: "add_score", label: "Score Interview", icon: "Star", variant: "secondary", description: "Rate the screening call" },
            { id: "add_note", label: "Add Note", icon: "StickyNote", variant: "ghost", description: "Add internal notes" },
            { id: "send_message", label: "Message", icon: "MessageSquare", variant: "ghost", description: "Send a message" },
            { id: "quick_reject", label: "Reject", icon: "X", variant: "danger", description: "Not a fit" },
        ],
    },
    interview: {
        primary: { id: "schedule_interview", label: "Schedule Interview", icon: "Calendar", variant: "primary", description: "Book an interview with this candidate" },
        secondary: [
            { id: "advance_stage", label: "Advance", icon: "ChevronRight", variant: "secondary", description: "Move to next stage" },
            { id: "add_score", label: "Score", icon: "Star", variant: "secondary", description: "Score the interview" },
            { id: "view_profile", label: "View Profile", icon: "User", variant: "ghost", description: "Open full candidate profile" },
            { id: "send_message", label: "Message", icon: "MessageSquare", variant: "ghost", description: "Send a message" },
            { id: "quick_reject", label: "Reject", icon: "X", variant: "danger", description: "Not a fit" },
        ],
    },
    assessment: {
        primary: { id: "send_assessment", label: "Send Assessment", icon: "ClipboardList", variant: "primary", description: "Send take-home assessment or task" },
        secondary: [
            { id: "advance_stage", label: "Advance", icon: "ChevronRight", variant: "secondary", description: "Move to next stage" },
            { id: "add_score", label: "Grade Submission", icon: "Star", variant: "secondary", description: "Score their submission" },
            { id: "add_note", label: "Add Note", icon: "StickyNote", variant: "ghost", description: "Add review notes" },
            { id: "quick_reject", label: "Reject", icon: "X", variant: "danger", description: "Not a fit" },
        ],
    },
    offer: {
        primary: { id: "generate_offer", label: "Generate Offer", icon: "FileCheck2", variant: "primary", description: "Create an offer letter from template" },
        secondary: [
            { id: "advance_stage", label: "Mark as Hired", icon: "CheckCircle", variant: "secondary", description: "Offer accepted — mark hired" },
            { id: "send_message", label: "Contact Candidate", icon: "MessageSquare", variant: "ghost", description: "Talk about the offer" },
            { id: "add_note", label: "Log Negotiation", icon: "StickyNote", variant: "ghost", description: "Record negotiation details" },
            { id: "quick_reject", label: "Offer Declined", icon: "X", variant: "danger", description: "Candidate declined" },
        ],
    },
    hired: {
        primary: { id: "view_profile", label: "View Profile", icon: "User", variant: "primary", description: "View the hired candidate's full profile" },
        secondary: [
            { id: "add_note", label: "Add Onboarding Note", icon: "StickyNote", variant: "ghost", description: "Add hire details or notes" },
            { id: "send_message", label: "Welcome Message", icon: "MessageSquare", variant: "ghost", description: "Send a welcome message" },
        ],
    },
    rejected: {
        primary: { id: "view_profile", label: "View Profile", icon: "User", variant: "ghost", description: "View candidate profile" },
        secondary: [
            { id: "add_note", label: "Add to Talent Pool", icon: "Star", variant: "secondary", description: "Save for future openings" },
            { id: "send_message", label: "Send Feedback", icon: "MessageSquare", variant: "ghost", description: "Provide rejection feedback" },
        ],
    },
};

export function getStageActions(stageType: string) {
    return STAGE_ACTIONS[stageType] ?? STAGE_ACTIONS["interview"];
}
