import {DashboardLayout as DashboardLayoutPure, useUser} from "@witel/webapp-builder";
import headerProfileItems from "@/core/data/headerProfileItems";
import sidebarMenu from "@/core/data/sidebarMenu";
import {GET_SIDEBAR_NOTIFICATION} from "@/core/data/apiRoutes";
import UserInfo from "@/middlewares/UserInfo";
import {useTranslations} from "next-intl";
import moment from "jalali-moment";

const DashboardLayout = (props) => {
    const {user} = useUser()
    const middlewaresProps = props.middlewaresProps || {}
    const t = useTranslations()
    return (
        <>
            <DashboardLayoutPure
                middlewares={{list: [UserInfo], props: {...middlewaresProps,loginUrl:'/login'}}}
                user_introduction={user.phone_number}
                headerProfileItems={headerProfileItems}
                headerSubtitle={`${t('today')} ${moment().locale('fa').format('LL')}`}
                sidebarMenu={sidebarMenu}
                urlNotification={GET_SIDEBAR_NOTIFICATION}
                BC_segmentsToRemove={['navgan']}
                {...props}
            />
        </>
    )
}

export default DashboardLayout