<?php
/**
 * License limited to a single site, for use on another site please purchase a license for this module.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 *
 * @author    Dingedi.com
 * @copyright Copyright 2025 © Dingedi All right reserved
 * @license   http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
 *
 * @category  Dingedi PrestaShop Modules
 */
if (!defined('_PS_VERSION_')) {
    exit;
}

class Homeslider_slides_lang extends Dingedi\TablesTranslation\DgTableTranslatable
{
    /**
     * @var string|false
     */
    public $module = 'ps_imageslider';
    /**
     * @var string|false
     */
    public $controller = self::CONTROLLER_ADMINMODULES;
    /**
     * @var string
     */
    public $table = 'homeslider_slides_lang';
    /**
     * @var string|false
     */
    public $object_model = false;

    public function __construct()
    {
        $primary_key = 'id_homeslider_slides';

        if (Dingedi\PsTools\DgShopInfos::isPrestaShop16()) {
            $this->module = 'homeslider';

            if (version_compare(_PS_VERSION_, '1.6.1.0', '<=')) {
                $primary_key = 'id_slide';
            }
        }

        $fields = ['title', 'description', 'legend'];
        $fields_rewrite = [];
        $fields_tags = [];

        parent::__construct($this->table, $primary_key, $fields, $fields_rewrite, $fields_tags);
    }

    /**
     * @return bool|int
     */
    public function getObjectIdInRequest()
    {
        return Tools::getValue('id_slide', parent::getObjectIdInRequest()); // TODO: Change the autogenerated stub
    }
}
