<?php
namespace Entity;

class Validator_BspImportedRefund extends \App\Entity\Utils\Extension_ValidateDefaultAbstract
{
    protected function isAccessible_insert()
    {
        // check user access
        if (!\App\UserAccess\CurrentUserAccessFast::getInstance()->hasAccessToOption('Modules/Bsp/Listing-insert')) {
            $this->entity->getMessages()->addWarningCode('noAccessToOption');
        }
    }

    protected function check_insert()
    {
    }

    protected function isAccessible_update()
    {
        // check user access
        if (!\App\UserAccess\CurrentUserAccessFast::getInstance()->hasAccessToOption('Modules/Bsp/Listing-update')) {
            $this->entity->getMessages()->addWarningCode('noAccessToOption');
        }
    }

    protected function isAvailable_update()
    {
        if (!\Entity\BspImportedRefund::select($this->entity->getId())->recordExists()) {
            $this->entity->getMessages()->addErrorCode('update_invalidId');
        }
    }

    protected function check_update()
    {
    }

    protected function isAccessible_delete()
    {
        // check user access
        if (!\App\UserAccess\CurrentUserAccessFast::getInstance()->hasAccessToOption('Modules/Bsp/Listing-delete')) {
            $this->entity->getMessages()->addWarningCode('noAccessToOption');
        }
    }

    protected function isAvailable_delete()
    {

    }
}