package Koha::Plugin::Pt::KEEPS::OpacDesign;

use Modern::Perl;

use C4::Context;
use base qw(Koha::Plugins::Base);
use Data::Dumper;

our $VERSION = '1.23';

our $metadata = {
    name   => 'KEEPS - Opac Design',
    author => 'Keep Solutions',
    description => 'Install files for Opac designs',
    date_authored   => '2023-05-30',
    date_updated    => '2024-01-01',
    minimum_version => '21.05',
    maximum_version => undef,
    version         => $VERSION,
};

sub new {
    my ( $class, $args ) = @_;

    $args->{'metadata'} = $metadata;
    $args->{'metadata'}->{'class'} = $class;

    my $self = $class->SUPER::new($args);


    return $self;
} 

# Mandatory even if does nothing
sub install {
    my ( $self, $args ) = @_;

    my $front_office_path = '/KEEPS/koha/opac/htdocs/opac-tmpl/bootstrap/css/keeps/frontoffice.css';
    my $images_path='/KEEPS/koha/opac/htdocs/opac-tmpl/bootstrap/images';

    # Use default design when there isn't anything
    #  coming from the COPY_IN
    if(!-f $front_office_path){
        system("cp -r /KEEPS/koha/var/lib/koha/plugins/Koha/Plugin/Pt/KEEPS/OpacDesign/design/base/css/keeps/frontoffice.css /KEEPS/koha/opac/htdocs/opac-tmpl/bootstrap/css/keeps");
    }
    if(!-d $images_path){
        system("cp -r /KEEPS/koha/var/lib/koha/plugins/Koha/Plugin/Pt/KEEPS/OpacDesign/design/base/images /KEEPS/koha/opac/htdocs/opac-tmpl/bootstrap/images");
    }
    
    return 1;
}

# Mandatory even if does nothing
sub upgrade {
    my ( $self, $args ) = @_;

    return 1;
}

# Mandatory even if does nothing
sub uninstall {
    my ( $self, $args ) = @_;

    return 1;
}

sub intranet_js {
    my ( $self ) = @_;

    return qq%

%;
}

sub opac_js {
    my ( $self ) = @_;



    return qq%
%;
}

1;

