import {
    type ViewStyle,
    StyleSheet
} from "react-native";
import {
    type SelectSheetDynamicStyleType
} from "./type";
import type {
    Mutable
} from "../../types";

const stylesheet = StyleSheet.create({
    toolsContainer: {
        justifyContent: "space-between",
        flexDirection: "row",
        alignItems: "center"
    },
    loadingContainer: {
        justifyContent: "center",
        alignItems: "center",
        flex: 1
    },
    checkIconContainer: {
        justifyContent: "center",
        alignItems: "center"
    },
    moreLoadingContainer: {
        justifyContent: "center",
        alignItems: "center",
        width: "100%"
    },
    headerContainer: {
        flexDirection: "column",
        width: "100%"
    },
    bottomContainer: {
        flexDirection: "row",
        alignItems: "center"
    },
    itemContainer: {
        flexDirection: "row",
        alignItems: "center",
        position: "relative"
    },
    disabledOverlay: {
        position: "absolute",
        zIndex: 99998,
        bottom: 0,
        right: 0,
        left: 0,
        top: 0
    },
    itemContentContainer: {
        zIndex: 99999,
        flex: 1
    }
});

export const useStyles = ({
    isSearchable,
    radiuses,
    spaces,
    colors
}: SelectSheetDynamicStyleType) => {
    const styles = {
        itemContainer: {
            backgroundColor: colors.content.container.mid,
            paddingHorizontal: spaces.spacingMd,
            paddingVertical: spaces.spacingSm,
            borderRadius: radiuses.form
        } as Mutable<ViewStyle>,
        contentContainer: {
            paddingVertical: spaces.spacingSm
        } as Mutable<ViewStyle>,
        headerContainer: {
            marginBottom: spaces.spacingSm
        } as Mutable<ViewStyle>,
        checkIconContainer: {
            height: 24 + spaces.spacingSm,
            width: 24 + spaces.spacingSm
        } as Mutable<ViewStyle>,
        cancelButton: {
            marginRight: spaces.spacingSm
        } as Mutable<ViewStyle>,
        bottomContainer: {
            marginTop: spaces.spacingSm,
            padding: spaces.spacingSm
        } as Mutable<ViewStyle>,
        okButton: {
            marginLeft: spaces.spacingSm
        } as Mutable<ViewStyle>,
        toolsContainer: {
            marginTop: spaces.spacingSm
        } as Mutable<ViewStyle>,
        loadingContainer: {
            padding: spaces.spacingMd
        } as Mutable<ViewStyle>,
        moreLoadingContainer: {
            padding: spaces.spacingSm
        } as Mutable<ViewStyle>,
        headerTitle: {

        } as Mutable<ViewStyle>
    };

    if(isSearchable) {
        styles.headerTitle.marginBottom = spaces.spacingSm;
    }

    return styles;
};
export default stylesheet;
