<?php
namespace App\Permissions\Modules;

use App\Model\UserTypes;

class Prescription extends BasePermissions{

    const PRESCRIPTION = "PRESCRIPTION_";
    const PRESCRIPTION_ADD = self::PRESCRIPTION."ADD";
    const PRESCRIPTION_EDIT = self::PRESCRIPTION."EDIT";
    const PRESCRIPTION_DELETE = self::PRESCRIPTION."DELETE";
    const PRESCRIPTION_VIEW = self::PRESCRIPTION."VIEW";


    public function permissions()
    {
        $permissions =  [
            [
                "text"=>"Prescription View",
                "id"=>self::PRESCRIPTION_VIEW,
                "state" => $this->selectNodes(self::PRESCRIPTION_VIEW)
            ],
            [
                "text"=>"Prescription Add",
                "id"=>self::PRESCRIPTION_ADD,
                "state" => $this->selectNodes(self::PRESCRIPTION_ADD)
            ],
            [
                "text"=>"Prescription Edit",
                "id"=>self::PRESCRIPTION_EDIT,
                "state" => $this->selectNodes(self::PRESCRIPTION_EDIT)
            ],
            [
                "text"=>"Prescription Delete",
                "id"=>self::PRESCRIPTION_DELETE,
                "state" => $this->selectNodes(self::PRESCRIPTION_DELETE)
            ]


        ];
        return ["text"=>"Prescription","id"=>self::PRESCRIPTION,"children"=>$permissions];
    }
    public function frontEndPermissions()
    {
        $prescription_permissions =
        [
            [
                "text"=>"Prescription View",
                "ability" => $this->apiPermissionSelected(self::PRESCRIPTION_VIEW)
            ],
            [
                "text"=>"Prescription Add",
                "ability" => $this->apiPermissionSelected(self::PRESCRIPTION_ADD)
            ],
            [
                "text"=>"Prescription Edit",
                "ability" => $this->apiPermissionSelected(self::PRESCRIPTION_EDIT)
            ],
            [
                "text"=>"Prescription Delete",
                "ability" => $this->apiPermissionSelected(self::PRESCRIPTION_DELETE)
            ]
        ];

        return ["text"=>"Prescriptions Permissions","permissions"=>$prescription_permissions];
    }
}
