/*
 *                                      Copyright 2025 WebPros International, LLC
 *                                                           All rights reserved.
 * copyright@cpanel.net                                         http://cpanel.net
 * This code is subject to the cPanel license. Unauthorized copying is prohibited.
 */

import { type Page, type Locator } from "@playwright/test";
import { CpanelPage, type CpanelServiceAccount } from "@page/cpanel/cpanel";
import { type TeamUser } from "@classes/account/team_user";

export class SitejetBanner extends CpanelPage {
    /** The Sitejet banner container*/
    sitejetBannerContainer: Locator;
    /** The Sitejet banner primary ad image*/
    sitejetBannerPhoto: Locator;
    /** The Sitejet banner secondary grid container*/
    sitejetBannerGrid2: Locator;
    /** The Sitejet banner container close button*/
    sitejetBannerCloseButton: Locator;

    /** The Sitejet Title */
    sitejetBannerTitle: Locator;
    /** The Sitejet Title in French locale*/
    sitejetBannerTitleFrench: Locator;
    /** The Sitejet SVG */
    sitejetBannerSVG: Locator;
    /** An array of the Sitejet bullet points*/
    sitejetBannerBulletPoints: Array<Locator>;
    /** The Sitejet Get Started button*/
    sitejetGetStartedButton: Locator;

    constructor(page: Page, account: CpanelServiceAccount | TeamUser) {
        super(page, account);

        // Locators for the Sitejet banner
        this.sitejetBannerContainer = this.page.locator("cp-sitejet-banner");
        this.sitejetBannerPhoto =
            this.sitejetBannerContainer.getByTestId("interface-image");
        this.sitejetBannerGrid2 =
            this.sitejetBannerContainer.locator("div.grid-item-2a");
        this.sitejetBannerCloseButton = this.sitejetBannerContainer.getByTestId(
            "sitejet-banner-close"
        );

        // Locators specific to the Sitejet Ad
        this.sitejetBannerTitle = this.sitejetBannerGrid2.getByText(
            "Create your website"
        );
        this.sitejetBannerTitleFrench = this.sitejetBannerGrid2.getByText(
            "Créez votre site web avec"
        );
        this.sitejetBannerSVG = this.sitejetBannerGrid2.locator("svg");
        this.sitejetBannerBulletPoints = [
            this.sitejetBannerGrid2
                .getByRole("listitem")
                .getByText("Ready-made templates"),
            this.sitejetBannerGrid2
                .getByRole("listitem")
                .getByText("Drag-and-drop functionality"),
            this.sitejetBannerGrid2
                .getByRole("listitem")
                .getByText("Add your own code"),
            this.sitejetBannerGrid2
                .getByRole("listitem")
                .getByText("Customize everything"),
        ];
        this.sitejetGetStartedButton = this.sitejetBannerGrid2
            .getByRole("button")
            .getByText("Click to get started");
     }

}
