package de.thpeetz.kontor.bookshelf.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.services.AdminService;
import de.thpeetz.kontor.bookshelf.BookshelfConstants;
import de.thpeetz.kontor.common.views.KontorLayoutUtil;
import de.thpeetz.kontor.security.SecurityService;

public class BookshelfLayout extends AppLayout {

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

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

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

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

    private HorizontalLayout getSecondaryNavigation() {
        HorizontalLayout navigation = new HorizontalLayout();
        navigation.addClassNames(LumoUtility.JustifyContent.CENTER, LumoUtility.Gap.SMALL, LumoUtility.Height.MEDIUM);
        navigation.add(BookshelfConstants.getBookLink(), BookshelfConstants.getArticleLink(),
                BookshelfConstants.getPublisherLink(), BookshelfConstants.getAuthorLink());
        return navigation;
    }
}
