import { PhoneOff, Check, Clock } from "lucide-react";
import { useTranslation } from "react-i18next";

import { CallResult } from "@/contracts/client.schemas";
import { Badge } from "@/shared";

type Props = {
	callResult: CallResult;
};

export function CallStatusBadge(props: Props) {
	const { t } = useTranslation("translation");

	switch (props.callResult) {
		case "Answered":
			return (
				<Badge variant="default" className="bg-green-600">
					<Check className="mr-1 h-3 w-3" />
					{t("callSuccess")}
				</Badge>
			);
		case "NoAnswer":
			return (
				<Badge variant="secondary">
					<PhoneOff className="mr-1 h-3 w-3" />
					{t("noAnswer")}
				</Badge>
			);
		case "Busy":
			return (
				<Badge variant="outline">
					<Clock className="mr-1 h-3 w-3" />
					{t("busy")}
				</Badge>
			);
	}

	return null;
}
