"use client";

import { FC } from "react";
import {
  SimpleForm,
  TextInput,
  BooleanInput,
  Create,
  CreateProps,
} from "react-admin";
import { useSession } from "next-auth/react";
import { UserRoleInput } from "./shared";

const UserCreate: FC<CreateProps> = () => {
  const { data: session } = useSession();
  return (
    <Create title="Create Users">
      <SimpleForm>
        <TextInput source="email" />
        <TextInput source="name" />
        <UserRoleInput session={session} initialValue="NONE" />
        <BooleanInput source="isActive" defaultValue={true} />
        <TextInput source="createdBy" defaultValue={session?.user?.name} />
      </SimpleForm>
    </Create>
  );
};

export default UserCreate;
