<?php
namespace App\Permissions\Modules;

use App\Model\UserTypes;

class Patients extends BasePermissions{

    const PATIENT = "PATIENT_";
    const PATIENT_ADD = self::PATIENT."ADD";
    const PATIENT_EDIT = self::PATIENT."EDIT";
    const PATIENT_DELETE = self::PATIENT."DELETE";
    const PATIENT_VIEW = self::PATIENT."VIEW";
    const PATIENT_FULL_DETAIL = self::PATIENT."DETAIL_FULL_DETAIL";
    const PATIENT_TABS = self::PATIENT."DETAIL_TABS";
    const PATIENT_DETAIL_TAB = self::PATIENT."DETAIL_TABS";
    const PATIENT_DETAIL_OVERVIEW_TAB = self::PATIENT."DETAIL_OVERVIEW_TAB";
    const PATIENT_DETAIL_NOTES_TAB = self::PATIENT."DETAIL_DETAIL_NOTES_TAB";
    const PATIENT_DETAIL_PRESCRIPTION_TAB = self::PATIENT."DETAIL_DETAIL_PRESCRIPTION_TAB";
    const PATIENT_DETAIL_PRESCRIPTION_EDIT = self::PATIENT."DETAIL_DETAIL_PRESCRIPTION_EDIT";
    const PATIENT_DETAIL_LAB_TEST_TAB = self::PATIENT."DETAIL_DETAIL_LAB_TEST_TAB";
    const PATIENT_DETAIL_PROFILE_TAB = self::PATIENT."DETAIL_DETAIL_PROFILE_TAB";

    public function permissions()
    {
        $permissions =  [
            [
                "text"=>"Patient View",
                "id"=>self::PATIENT_VIEW,
                "state" => $this->selectNodes(self::PATIENT_VIEW)
            ],
            [
                "text"=>"Patient Details",
                "id"=>self::PATIENT_FULL_DETAIL,
                "state" => $this->selectNodes(self::PATIENT_FULL_DETAIL)
            ],
            [
                "text"=>"Patient Add",
                "id"=>self::PATIENT_ADD,
                "state" => $this->selectNodes(self::PATIENT_ADD)
            ],
            [
                "text"=>"Patient Edit",
                "id"=>self::PATIENT_EDIT,
                "state" => $this->selectNodes(self::PATIENT_EDIT)
            ],
            [
                "text"=>"Patient Delete",
                "id"=>self::PATIENT_DELETE,
                "state" => $this->selectNodes(self::PATIENT_DELETE)
            ],
            [
                "text"=>"Patient Detail Tabs",
                "id"=>self::PATIENT_TABS,
                "children"=>[
                    [
                        "text"=>"Patient Overview Tab",
                        "id"=>self::PATIENT_DETAIL_OVERVIEW_TAB,
                        "state" => $this->selectNodes(self::PATIENT_DETAIL_OVERVIEW_TAB)
                    ],
                    [
                        "text"=>"Patient Notes Tab",
                        "id"=>self::PATIENT_DETAIL_NOTES_TAB,
                        "state" => $this->selectNodes(self::PATIENT_DETAIL_NOTES_TAB)
                    ],
                    [
                        "text"=>"Patient Prescription Tab",
                        "id"=>self::PATIENT_DETAIL_PRESCRIPTION_TAB,
                        "state" => $this->selectNodes(self::PATIENT_DETAIL_PRESCRIPTION_TAB)
                    ],
                    [
                        "text"=>"Patient Prescription Edit",
                        "id"=>self::PATIENT_DETAIL_PRESCRIPTION_EDIT,
                        "state" => $this->selectNodes(self::PATIENT_DETAIL_PRESCRIPTION_EDIT)
                    ],
                    [
                        "text"=>"Patient Lab Test Tab",
                        "id"=>self::PATIENT_DETAIL_LAB_TEST_TAB,
                        "state" => $this->selectNodes(self::PATIENT_DETAIL_LAB_TEST_TAB)
                    ],
                    [
                        "text"=>"Patient Profile Tab",
                        "id"=>self::PATIENT_DETAIL_PROFILE_TAB,
                        "state" => $this->selectNodes(self::PATIENT_DETAIL_PROFILE_TAB)
                    ],
                ]
            ]
        ];
        return ["text"=>"Patient","id"=>self::PATIENT,"children"=>$permissions];
    }
    public function frontEndPermissions()
    {
        $patients_permissions =
        [
            [
                "text"=>"Patient View",
                "ability" => $this->apiPermissionSelected(self::PATIENT_VIEW)
            ],
            [
                "text"=>"Patient Add",
                "ability" => $this->apiPermissionSelected(self::PATIENT_ADD)
            ],
            [
                "text"=>"Patient Edit",
                "ability" => $this->apiPermissionSelected(self::PATIENT_EDIT)
            ],
            [
                "text"=>"Patient Delete",
                "ability" => $this->apiPermissionSelected(self::PATIENT_DELETE)
            ],
            [
                "text"=>"Patient Detail Tabs",
                "children"=>[
                    [
                        "text"=>"Patient Overview Tab",
                        "ability" => $this->apiPermissionSelected(self::PATIENT_DETAIL_OVERVIEW_TAB)
                    ],
                    [
                        "text"=>"Patient Notes Tab",
                        "ability" => $this->apiPermissionSelected(self::PATIENT_DETAIL_NOTES_TAB)
                    ],
                    [
                        "text"=>"Patient Prescription Tab",
                        "ability" => $this->apiPermissionSelected(self::PATIENT_DETAIL_PRESCRIPTION_TAB)
                    ],
                    [
                        "text"=>"Patient Prescription Edit",
                        "ability" => $this->apiPermissionSelected(self::PATIENT_DETAIL_PRESCRIPTION_EDIT)
                    ],
                    [
                        "text"=>"Patient Lab Test Tab",
                        "ability" => $this->apiPermissionSelected(self::PATIENT_DETAIL_LAB_TEST_TAB)
                    ],
                    [
                        "text"=>"Patient Profile Tab",
                        "ability" => $this->apiPermissionSelected(self::PATIENT_DETAIL_PROFILE_TAB)
                    ],
                ]
            ]
        ];

        return ["text"=>"Patients Permissions","permissions"=>$patients_permissions];
    }
}
