package de.thpeetz.kontor.admin.views;

import com.vaadin.flow.component.applayout.AppLayout;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.theme.lumo.LumoUtility;

import de.thpeetz.kontor.admin.AdminConstants;
import de.thpeetz.kontor.admin.services.AdminService;
import de.thpeetz.kontor.common.views.KontorLayoutUtil;
import de.thpeetz.kontor.security.SecurityService;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class AdminLayout extends AppLayout {

    @SuppressWarnings("unused")
    private final AdminService adminService;

    @SuppressWarnings("unused")
    private final SecurityService securityService;

    public AdminLayout(AdminService adminService, SecurityService securityService) {
        this.adminService = adminService;
        this.securityService = securityService;

        KontorLayoutUtil layout = new KontorLayoutUtil(this, adminService, securityService);
        layout.setSecondaryNavigation(getSecondaryNavigation());
        layout.createHeader(AdminConstants.ADMIN_TITLE);
    }

    private HorizontalLayout getSecondaryNavigation() {
        HorizontalLayout navigation = new HorizontalLayout();
        navigation.addClassNames(LumoUtility.JustifyContent.CENTER, LumoUtility.Gap.SMALL, LumoUtility.Height.MEDIUM);
        navigation.add(AdminConstants.getProfileNavigation(), AdminConstants.getPermissionNavigation(),
                AdminConstants.getAuthorizationNavigation());
        return navigation;
    }
}
