<?php

namespace Hura8\Components\Deal\AdminController;

use Hura8\Components\Deal\Model\DealCollectionModel;
use Hura8\System\Controller\aAdminEntityBaseController;

class ADealCollectionController extends aAdminEntityBaseController
{

    /* @var  DealCollectionModel $objDealCollectionModel */
    protected $objDealCollectionModel;

    public function __construct() {
        $this->objDealCollectionModel = new DealCollectionModel();
        parent::__construct($this->objDealCollectionModel);
    }

    public function getAllProductIdInCollection($collection_id) {
        return $this->objDealCollectionModel->getAllProductIdInCollection($collection_id);
    }

    public function getAllDealIdInCollection($collection_id) {
        return $this->objDealCollectionModel->getAllDealIdInCollection($collection_id);
    }

    public function updateAllDealInCollection($collection_id, $price, $time){
        return $this->objDealCollectionModel->updateAllDealInCollection($collection_id, $price, $time);
    }

    public function addProductToCollection($product_id, $collection_id){
        return $this->objDealCollectionModel->addProductToCollection($product_id, $collection_id);
    }

    public function removeFromCollection($deal_id, $collection_id){
        $this->objDealCollectionModel->removeFromCollection($deal_id, $collection_id);
    }

    public function addToCollection($deal_id, $collection_id){
        $this->objDealCollectionModel->addToCollection($deal_id, $collection_id);
    }

    public function updateCollectionView($id){
        $this->objDealCollectionModel->updateCollectionView($id);
    }

    protected function deleteFileBeforeDeleteItem($item_id): bool
    {
        return true;
    }
}
