<?php

namespace Hura8\Components\ConfigGroup\AdminController;

use Hura8\Components\ConfigGroup\Controller\bConfigGroupController;
use Hura8\Interfaces\iEntityAdminController;
use Hura8\Traits\AdminEntityBaseControllerTraits;


class AConfigGroupController extends bConfigGroupController implements iEntityAdminController
{

    use AdminEntityBaseControllerTraits;

    public function deleteAttribute($id, $group_id = 0) {
        $this->objConfigGroupModel->deleteAttribute($id, $group_id);
    }


    public function updateAttribute($id, $info) {
        $this->objConfigGroupModel->updateAttribute($id, $info) ;
    }


    public function createAttribute($info) {
        return $this->objConfigGroupModel->createAttribute($info) ;
    }


    public function createAttributeValue($info) {
        $this->objConfigGroupModel->createAttributeValue($info);
    }


    public function deleteAttributeValue($id) {
        $this->objConfigGroupModel->deleteAttributeValue($id);
    }


    public function updateAttributeValue($id, $info) {
        $this->objConfigGroupModel->updateAttributeValue($id, $info);
    }


    public function createProduct($product_id, $group_id, array $attribute_config) {
        $this->objConfigGroupModel->createProduct($product_id, $group_id, $attribute_config);
    }


    public function deleteProduct($product_id, $group_id) {
        $this->objConfigGroupModel->deleteProduct($product_id, $group_id);
    }


    public function updateProduct($product_id, $group_id, array $attribute_config, $product_name_in_group = '') {

        return $this->objConfigGroupModel->updateProduct($product_id, $group_id, $attribute_config, $product_name_in_group);
    }


    public function getProductInGroup($group_id){
        return $this->objConfigGroupModel->getProductInGroup($group_id);
    }


    public function getGroupConfig($item_id) {
        return $this->objConfigGroupModel->getGroupConfig($item_id);
    }


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


}
