import { StatusBadge, StatusVariant } from "@/Components/shared/StatusBadge";
import { ProductionOrderStatus, STATUS_CONFIG } from "@/constants/production-order";

interface ProductionOrderStatusBadgeProps {
    status: ProductionOrderStatus;
    className?: string;
}

export default function ProductionOrderStatusBadge({
    status,
    className,
}: ProductionOrderStatusBadgeProps) {
    const config = STATUS_CONFIG[status] || { label: "未知", variant: "outline" };

    const getVariant = (status: string): StatusVariant => {
        switch (status) {
            case 'draft':
                return 'neutral';
            case 'pending':
                return 'warning';
            case 'approved':
                return 'success';
            case 'in_progress':
                return 'info';
            case 'completed':
                return 'success';
            case 'cancelled':
                return 'destructive';
            default:
                return 'neutral';
        }
    };

    return (
        <StatusBadge
            variant={getVariant(status)}
            className={className}
        >
            {config.label}
        </StatusBadge>
    );
}
