import { Typography, Box, useTheme, InputBase } from "@mui/material";
import { useState } from "react";
import CustomButton from "../../components/CustomButton";
import SectionWrapper from "../../components/SectionWrapper";
import Message from "./Message";


export default function Support() {
    const theme = useTheme();
    const [messageText, setMessageText] = useState<string>("");

    return (
        <SectionWrapper
            maxWidth="lg"
            sx={{
                mt: "25px",
                mb: "70px",
            }}
        >
            <Typography
                sx={{
                    fontWeight: 400,
                    fontSize: "12px",
                    lineHeight: "14px",
                    color: theme.palette.grey2.main,
                }}
            >
                {`Все тарифы — `}
                <Typography
                    component="span"
                    sx={{
                        fontWeight: 400,
                        fontSize: "12px",
                        lineHeight: "14px",
                        color: theme.palette.fadePurple.main,
                        textUnderlinePosition: "under",
                        textDecorationColor: theme.palette.brightPurple.main,
                    }}
                >Запрос в службу техподдержки</Typography>
            </Typography>
            <Typography variant="h4" sx={{ mt: "20px", mb: "40px" }}>Запрос в службу техподдержки</Typography>
            <Box
                sx={{
                    backgroundColor: "white",
                    display: "flex",
                    borderRadius: "12px",
                    p: "20px",
                    gap: "40px",
                    boxShadow: `0px 100px 309px rgba(210, 208, 225, 0.24), 
                                0px 41.7776px 129.093px rgba(210, 208, 225, 0.172525),
                                0px 22.3363px 69.0192px rgba(210, 208, 225, 0.143066), 
                                0px 12.5216px 38.6916px rgba(210, 208, 225, 0.12), 
                                0px 6.6501px 20.5488px rgba(210, 208, 225, 0.0969343), 
                                0px 2.76726px 8.55082px rgba(210, 208, 225, 0.0674749)`,
                }}
            >
                <Box
                    sx={{
                        display: "flex",
                        alignItems: "start",
                        flexDirection: "column",
                        flexGrow: 1,
                    }}
                >
                    <Typography variant="h5" mb="4px">Заголовок</Typography>
                    <Typography sx={{
                        fontWeight: 400,
                        fontSize: "14px",
                        lineHeight: "17px",
                        color: theme.palette.grey2.main,
                        mb: "9px",
                    }}>Создан: 15.09.22 08:39</Typography>
                    <Box
                        sx={{
                            backgroundColor: "#ECECF3",
                            border: `1px solid ${theme.palette.grey2.main}`,
                            borderRadius: "10px",
                            overflow: "hidden",
                            width: "100%",
                            minHeight: "345px",
                            display: "flex",
                            flexDirection: "column",

                        }}
                    >
                        <Box
                            sx={{
                                flexGrow: 1,
                                width: "100%",
                                borderBottom: `1px solid ${theme.palette.grey2.main}`,
                                p: "20px",
                                display: "flex",
                                flexDirection: "column",
                                gap: "20px",
                                maxHeight: "500px",
                                overflow: "auto",
                            }}
                        >
                            <Message
                                text="Текст-заполнитель — это текст, который имеет "
                                time="16:40"
                                isSelf={false}
                            />
                            <Message
                                text="Текст-заполнитель — это текст, который имеет "
                                time="16:40"
                                isSelf={true}
                            />
                            <Message
                                text="Текст-заполнитель — это текст"
                                time="16:40"
                                isSelf={false}
                            />
                        </Box>
                        <InputBase
                            value={messageText}
                            fullWidth
                            placeholder="Текст обращения"
                            id="message"
                            multiline
                            sx={{
                                width: "100%",
                                p: 0,
                            }}
                            inputProps={{
                                sx: {
                                    fontWeight: 400,
                                    fontSize: "16px",
                                    py: "9px",
                                    px: "19px",
                                }
                            }}
                            onChange={e => setMessageText(e.target.value)}
                        />
                    </Box>
                </Box>
                <Box
                    sx={{
                        alignSelf: "end",
                    }}
                >
                    <CustomButton
                        variant="contained"
                        sx={{
                            backgroundColor: theme.palette.brightPurple.main,
                            mt: "auto",
                        }}
                    >Отправить</CustomButton>
                </Box>
            </Box>
        </SectionWrapper>
    );
}