import MuiDialog from '@/components/MuiDialog';
import axios from '@/utils/axios';
import { Button, Checkbox, Typography } from '@mui/material';
import { Paper } from '@mui/material';
import { Stack } from '@mui/material';
import { enqueueSnackbar } from 'notistack';
import React, { useState } from 'react';
import FormHistoryPerawatan from './FormHistoryPerawatan';

type DialogDocumentRequestType = {
    openDialog: boolean;
    setOpenDialog: React.Dispatch;
    onSubmit?: void;
    claim: any; // TODO create ClaimType
    encounter?: any;
}

export default function DialogDocumentRequest({ openDialog, setOpenDialog, onSubmit, claim } : DialogDocumentRequestType) {

  const handleSubmit = (data) => {
    
    axios.post(`claims/${claim.id}/encounters`, data)
        .then((res) => {
            enqueueSnackbar(res.data.message, {variant: 'success'})
            setOpenDialog(false);
        })
        .catch((err) => {
            enqueueSnackbar(err.message, {variant: 'error'})
        })

    onSubmit()
  };

  const documentTypes = [
    {
        type: "result",
        name: "Dokumen Hasil Penunjang"
    },
    {
        type: "claim-diagnosis",
        name: "Dokumen Diagnosa"
    },
    {
        type: "claim-diagnosis",
        name: "Dokumen Diagnosa"
    }
  ];
  

  const getContent = () => (
    <Stack spacing={1} marginTop={2}>
        {documentTypes.map((document, index) => (
            <Stack key={index} direction="row" alignContent="center" alignItems="center">
                <Checkbox></Checkbox>
                <Typography>{document.name}</Typography>
            </Stack>
        ))}
    </Stack>
  );

  return (
    <MuiDialog
      title={{ name: 'Request Document'}}
      openDialog={openDialog}
      setOpenDialog={setOpenDialog}
      content={getContent()}
      maxWidth="xl"
    />
  );
}
