import {EmploymentStatus, EMPLOYMENT_STATUS} from "@/interfaces/user";
import {RadioGroup} from "@headlessui/react";
import clsx from "clsx";

interface Props {
	value?: EmploymentStatus;
	onChange: (value?: EmploymentStatus) => void;
}

export default function EmploymentStatusInput({value, onChange}: Props) {
	return (
		<div className="relative flex flex-col gap-3 w-full">
			<label className="font-normal text-base text-mti-gray-dim">Employment Status *</label>
			<RadioGroup value={value} onChange={onChange} className="grid grid-cols-2 items-center gap-4 place-items-center">
				{EMPLOYMENT_STATUS.map(({status, label}) => (
					<RadioGroup.Option value={status} key={status}>
						{({checked}) => (
							<span
								className={clsx(
									"px-6 py-4 w-40 md:w-48 flex justify-center text-sm font-normal rounded-full border focus:outline-none cursor-pointer",
									"transition duration-300 ease-in-out",
									!checked ? "bg-white border-mti-gray-platinum" : "bg-mti-purple-light border-mti-purple-dark text-white",
								)}>
								{label}
							</span>
						)}
					</RadioGroup.Option>
				))}
			</RadioGroup>
		</div>
	);
}
