<?php
defined('BASEPATH') or exit('No direct script access allowed');

/**
 * @property Promotion_model $Promotion_model
 */
class Promotion extends MY_ApiController
{
    public function __construct()
    {
        parent::__construct();
    }

    public function listing()
    {
        $this->is_get();
        $params = $this->input->get();

        $tenant_no = $params['tenant_no'];
        $banner_only = $params['banner_only'] ?? 0;

        $this->load->model('Promotion_model');
        $this->Promotion_model->setTenantNo($tenant_no);
        $res = $this->Promotion_model->get_promotions($banner_only);

        echo $this->respond([
            'promotions' => $res
        ]);
    }
}
