import React from "react";
import { Portal, Button, Dialog, useTheme } from "react-native-paper";
import About from "@/components/About";
import Privacy from "@/components/Privacy";
import Broken from "@/components/Broken";


interface DialogsProps {
    aboutVisible: boolean;
    privacyVisible: boolean;
    bugVisible: boolean;
    toggleAbout: () => void;
    togglePrivacy: () => void;
    toggleBug: () => void;
}

const Dialogs: React.FC<DialogsProps> = ({ aboutVisible, privacyVisible, bugVisible, toggleAbout, togglePrivacy, toggleBug }) => {
    const theme = useTheme();
    return (
        <Portal>
            <Dialog visible={aboutVisible} onDismiss={() => toggleAbout()}
                    style={{backgroundColor: theme.colors.primaryContainer}}>
                <Dialog.Title style={{color: theme.colors.primary, textAlign: 'center'}}>About Us</Dialog.Title>
                <About/>
                <Dialog.Actions style={{justifyContent: "center"}}>
                    <Button onPress={() => toggleAbout()} mode="contained"
                            style={{backgroundColor: theme.colors.inversePrimary}}
                            labelStyle={{color: theme.colors.primary}}>
                        Close
                    </Button>
                </Dialog.Actions>
            </Dialog>
            <Dialog visible={privacyVisible} onDismiss={() => togglePrivacy()}
                    style={{backgroundColor: theme.colors.primaryContainer}}>
                <Dialog.Title style={{color: theme.colors.primary, textAlign: 'center'}}>Privacy Policy</Dialog.Title>
                <Privacy/>
                <Dialog.Actions style={{justifyContent: "center"}}>
                    <Button onPress={() => togglePrivacy()} mode="contained"
                            style={{backgroundColor: theme.colors.inversePrimary}}
                            labelStyle={{color: theme.colors.primary}}>
                        Close
                    </Button>
                </Dialog.Actions>
            </Dialog>
            <Dialog visible={bugVisible} onDismiss={() => toggleBug()}
                    style={{backgroundColor: theme.colors.primaryContainer}}>
                <Dialog.Title style={{color: theme.colors.primary, textAlign: 'center'}}>Report A Bug</Dialog.Title>
                <Broken/>
                <Dialog.Actions style={{justifyContent: "center"}}>
                    <Button onPress={() => toggleBug()} mode="contained"
                            style={{backgroundColor: theme.colors.inversePrimary}}
                            labelStyle={{color: theme.colors.primary}}>
                        Close
                    </Button>
                </Dialog.Actions>
            </Dialog>
        </Portal>
    )
}

export default Dialogs;
