package de.thpeetz.kontor.comics.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.comics.ComicConstants;
import de.thpeetz.kontor.common.views.KontorLayoutUtil;
import de.thpeetz.kontor.security.SecurityService;
import lombok.extern.slf4j.Slf4j;

/**
 * Represents a custom layout for the comic view in the application.
 * This layout extends the AppLayout class.
 */
@Slf4j
public class ComicLayout extends AppLayout {

    private final AdminService adminService;

    private final SecurityService securityService;

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

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

    private HorizontalLayout getSecondaryNavigation() {
        HorizontalLayout navigation = new HorizontalLayout();
        navigation.addClassNames(LumoUtility.JustifyContent.CENTER, LumoUtility.Gap.SMALL, LumoUtility.Height.MEDIUM);
        navigation.add(ComicConstants.getComicLink(), ComicConstants.getPublisherLink(), ComicConstants.getIssueLink(),
                ComicConstants.getTradePaperbackLink(), ComicConstants.getStoryArcLink(),
                ComicConstants.getVolumeLink(), ComicConstants.getArtistLink(), ComicConstants.getComicWorkLink(),
                ComicConstants.getWorktypeLink());
        return navigation;
    }
}

