<?php
namespace App\Permissions\Modules;

use App\Model\UserTypes;

class Analytics extends BasePermissions{

    const ANALYTICS = "ANALYTICS_";
    const ANALYTICS_OVERVIEW = self::ANALYTICS."OVERVIEW";
    const ANALYTICS_ORDERS = self::ANALYTICS."ORDERS";
    const ANALYTICS_ORDERS_DOWNLOAD = self::ANALYTICS_ORDERS."DOWNLOAD";
    const ANALYTICS_PRODUCTS = self::ANALYTICS."PRODUCTS";
    const ANALYTICS_PRODUCTS_DOWNLOAD = self::ANALYTICS_PRODUCTS."DOWNLOAD";


    public function permissions()
    {
        $permissions =  [
            [
                "text"=>"Analytics Overview",
                "id"=>self::ANALYTICS_OVERVIEW,
                "state" => $this->selectNodes(self::ANALYTICS_OVERVIEW)
            ],
            [
                "text"=>"Analytics Orders",
                "id"=>self::ANALYTICS_ORDERS,
                "state" => $this->selectNodes(self::ANALYTICS_ORDERS)
            ],
            [
                "text"=>"Analytics Orders Download Data",
                "id"=>self::ANALYTICS_ORDERS_DOWNLOAD,
                "state" => $this->selectNodes(self::ANALYTICS_ORDERS_DOWNLOAD)
            ],
            [
                "text"=>"Analytics Products",
                "id"=>self::ANALYTICS_PRODUCTS,
                "state" => $this->selectNodes(self::ANALYTICS_PRODUCTS)
            ],
            [
                "text"=>"Analytics Products Downlaod Data",
                "id"=>self::ANALYTICS_PRODUCTS_DOWNLOAD,
                "state" => $this->selectNodes(self::ANALYTICS_PRODUCTS_DOWNLOAD)
            ]


        ];
        return ["text"=>"Analytics","id"=>self::ANALYTICS,"children"=>$permissions];
    }
    public function frontEndPermissions()
    {
        $analytics_permissions =
        [
            [
                "text"=>"Analytics Overview",
                "ability" => $this->apiPermissionSelected(self::ANALYTICS_OVERVIEW)
            ],
            [
                "text"=>"Analytics Orders",
                "ability" => $this->apiPermissionSelected(self::ANALYTICS_ORDERS)
            ],
            [
                "text"=>"Analytics Orders Download Data",
                "ability" => $this->apiPermissionSelected(self::ANALYTICS_ORDERS_DOWNLOAD)
            ],
            [
                "text"=>"Analytics Products",
                "ability" => $this->apiPermissionSelected(self::ANALYTICS_PRODUCTS)
            ],
            [
                "text"=>"Analytics Products Downlaod Data",
                "ability" => $this->apiPermissionSelected(self::ANALYTICS_PRODUCTS_DOWNLOAD)
            ]
        ];

        return ["text"=>"Analytics Permissions","permissions"=>$analytics_permissions];
    }
}
