<?php
namespace App\Permissions\Modules;

use App\Model\UserTypes;
use GuzzleHttp\Psr7\Request;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels;

class Subscription extends BasePermissions{

    const SUBSCRIPTION = "SUBSCRIPTION_";
    const SUBSCRIPTION_ADD = self::SUBSCRIPTION."ADD";
    const SUBSCRIPTION_EDIT = self::SUBSCRIPTION."EDIT";
    const SUBSCRIPTION_DELETE = self::SUBSCRIPTION."DELETE";
    const SUBSCRIPTION_VIEW = self::SUBSCRIPTION."VIEW";



    public function permissions()
    {
        $permissions =  [
            [
                "text"=>"Subscription View",
                "id"=>self::SUBSCRIPTION_VIEW,
                "state" => $this->selectNodes(self::SUBSCRIPTION_VIEW)
            ],
            [
                "text"=>"Subscription Add",
                "id"=>self::SUBSCRIPTION_ADD,
                "state" => $this->selectNodes(self::SUBSCRIPTION_ADD)
            ],
            [
                "text"=>"Subscription Edit",
                "id"=>self::SUBSCRIPTION_EDIT,
                "state" => $this->selectNodes(self::SUBSCRIPTION_EDIT)
            ],
            [
                "text"=>"Subscription Delete",
                "id"=>self::SUBSCRIPTION_DELETE,
                "state" => $this->selectNodes(self::SUBSCRIPTION_DELETE)
            ]
        ];
        return ["text"=>"Subscription","id"=>self::SUBSCRIPTION,"children"=>$permissions];
    }
    public function frontEndPermissions()
    {
        $subscription_permissions =
        [
            [
                "text"=>"Subscription View",
                "ability" => $this->apiPermissionSelected(self::SUBSCRIPTION_VIEW)
            ],
            [
                "text"=>"Subscription Add",
                "ability" => $this->apiPermissionSelected(self::SUBSCRIPTION_ADD)
            ],
            [
                "text"=>"Subscription Edit",
                "ability" => $this->apiPermissionSelected(self::SUBSCRIPTION_EDIT)
            ],
            [
                "text"=>"Subscription Delete",
                "ability" => $this->apiPermissionSelected(self::SUBSCRIPTION_DELETE)
            ]
        ];
        return ["text"=>"Subscriptions Permissions","permissions"=>$subscription_permissions];
    }
}
