"use client";

import Stack from "@mui/material/Stack";
import Box from "@mui/material/Box";
import Card from "@mui/material/Card";
import CardContent from "@mui/material/CardContent";
import FormControl from "@mui/material/FormControl";
import Grid from "@mui/material/Grid";
import InputLabel from "@mui/material/InputLabel";
import MenuItem from "@mui/material/MenuItem";
import Select from "@mui/material/Select";
import TextField from "@mui/material/TextField";
import Typography from "@mui/material/Typography";
import { useTranslation } from "react-i18next";
import CardActions from "@mui/material/CardActions";
import RestartAlt from "@mui/icons-material/RestartAlt";
import Button from "@mui/material/Button";
import { Controller, useFormContext } from "react-hook-form";
import { CreatePositionInputs } from "@/app/api/positions/actions";

const PositionDetails: React.FC = ({
}) => {
  const { t } = useTranslation();
  const {
    register,
    formState: { errors },
    control,
  } = useFormContext<CreatePositionInputs>();

  return (
    <Card>
      <CardContent component={Stack} spacing={4}>
        <Box>
          <Typography variant="overline" display="block" marginBlockEnd={1}>
            {t("Position Details")}
          </Typography>
          <Grid container spacing={2} columns={{ xs: 6, sm: 12 }}>
            <Grid item xs={6}>
              <TextField
                label={t("Position Code")}
                fullWidth
                {...register("code", {
                  required: "Position code required!",
                })}
                error={Boolean(errors.code)}
              />
            </Grid>
            <Grid item xs={6}>
              <TextField
                label={t("Position Name")}
                fullWidth
                {...register("name", {
                  required: "Position name required!",
                })}
                error={Boolean(errors.name)}
              />
            </Grid>
            <Grid item xs={6}>
              <TextField
                label={t("Position Description")}
                fullWidth
                {...register("description", {
                  required: "Please enter a description",
                })}
                error={Boolean(errors.description)}
              />
            </Grid>
          </Grid>
        </Box>
        {/* <CardActions sx={{ justifyContent: "flex-end" }}>
          <Button variant="text" startIcon={<RestartAlt />}>
            {t("Reset")}
          </Button>
        </CardActions> */}
      </CardContent>
    </Card>
  );
};

export default PositionDetails;