import RoundedButton from "@/components/elements/RoundedButton";

interface PublicTypeSelectionProps {
  selectedPublicType: string;
  setSelectedPublicType: (type: string) => void;
  setFieldValue: (field: string, value: string) => void;
}

const PublicTypeSelection = ({
  selectedPublicType,
  setSelectedPublicType,
  setFieldValue,
}: PublicTypeSelectionProps) => {
  return (
    <div className="flex gap-2">
      {["true", "false"].map((type) => (
        <RoundedButton
          key={type}
          className={`p-1 min-w-32 ${
            selectedPublicType === type ? "bg-blue-500 text-white" : ""
          }`}
          onClick={(e) => {
            e.preventDefault();
            setSelectedPublicType(type);
            setFieldValue("publicType", type);
          }}
        >
          {type === "true" ? "روابط عمومی بالا" : "بدون محدودیت"}
        </RoundedButton>
      ))}
    </div>
  );
};

export default PublicTypeSelection;
