package Cpanel::Config::ConfigObj::Driver::Sitejet::META;

# cpanel - Cpanel/Config/ConfigObj/Driver/Sitejet/META.pm
#                                      Copyright 2024 WebPros International, LLC
#                                                            All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited.

use cPstrict;

=encoding utf-8

=head1 NAME

Cpanel::Config::ConfigObj::Driver::Sitejet::META

=head1 DESCRIPTION

Feature Showcase metadata for Sitejet

=cut

use parent qw(Cpanel::Config::ConfigObj::Interface::Config::Version::v1);

our $VERSION = "2.0";

=head1 FUNCTIONS

=head2 translate

Returns the string. Provides the string to the locale tool.

=cut

sub translate ($string) { return $string; }

=head2 get_driver_name()

Returns the driver name. This name is used as the filename for the touchfile
put in the C</var/cpanel/activate/features/> directory.

=cut

use constant get_driver_name => 'sitejet_builder_campaign_04_2025';
use constant top_line        => translate("Create websites faster with the new AI-powered generator in Sitejet — [output,strong,now available for new website creation]. Just enter a company name, select a business type, and provide a few details. Sitejet AI will generate a personalized site with optimized content, layout, colors, and fonts.");
use constant bullet_point_strings => (
    translate("AI-driven design and content"),
    translate("Faster time to first website"),
    translate("Custom templates, SEO-friendly and responsive"),
);
use constant note => translate("Note: The AI Generator is only available when creating new websites — it cannot be used on existing sites. ");

my ( $short, $long );
$short = $long = translate('Sitejet AI Website Generator');

=head2 content

Defines the content used in the Feature Showcase entry

=cut

sub content {
    my ($locale) = @_;
    my $topline  = top_line;
    my $note     = note;
    my $abstract;

    if ($locale) {
        $short   = $locale->makevar($short);
        $long    = $locale->makevar($long);
        $topline = $locale->makevar($topline);
        my $bullet_points = "";
        foreach my $bullet_point (bullet_point_strings) {
            $bullet_points .= "<li style=\"list-style-type:disc;\">" . $locale->makevar($bullet_point) . "</li>";
        }
        $abstract = join(
            "",
            "<p>" . $topline . "</p>",
            "<ol>",
            $bullet_points,
            "</ol>",
            "<em>" . $locale->makevar($note) . "</em>",
        );
    }

    else {
        $topline =~ s/\[.+,([^]]*)\]/<strong>$1<\/strong>/;
        my $bullet_points = "";
        foreach my $bullet_point (bullet_point_strings) {
            $bullet_points .= "<li style=\"list-style-type:disc;\">$bullet_point</li>";
        }
        $abstract = join(
            "",
            "<p>$topline</p>",
            "<ol>",
            $bullet_points,
            "</ol>",
            "<em>$note</em>",
        );
    }

    return {
        'vendor' => 'WebPros International, LLC',
        'url'    => 'https://go.cpanel.net/sitejet-builder',
        'name'   => {
            'short'  => $short,
            'long'   => $long,
            'driver' => get_driver_name(),
        },
        'first_appears_in' => '110',
        'version'          => $Cpanel::Config::ConfigObj::Driver::Sitejet::META::VERSION,
        'readonly'         => 1,
        'abstract'         => $abstract,
    };
}

=head2 showcase()

Determine how and if an item should appear in the showcase

=cut

sub showcase {
    return { 'is_recommended' => 0, 'is_spotlight_feature' => 1 };
}

1;
