"use client";

import { SelectInput, useRecordContext } from "react-admin";

export const UserRoleInput = (props: any) => {
  const record = useRecordContext();
  return (
    <SelectInput
      source="userRole"
      choices={[
        { id: "NONE", name: "None" },
        { id: "USER", name: "User" },
        { id: "ADMIN", name: "Admin" },
      ]}
      disabled={props.session.user.id === record.id}
      {...props}
    />
  );
};
