<?php

namespace App\Helpers;

use App\Models\GeneralSettings;

class SettingsHelper
{
    public static function getObj($type = null, $name)
    {
        $res = null;
        if ($type) {
            $res = GeneralSettings::where("type", $type)->where("name", $name)->first();
        } else {
            $res = GeneralSettings::where("name", $name)->first();
        }

        return $res;
    }

    public static function getValue($type = null, $name)
    {
        $res = null;
        if ($type) {
            $r = GeneralSettings::where("type", $type)->where("name", $name)->first();
            if ($r) {
                $res = $r->value;
            }
        } else {
            $r = GeneralSettings::where("name", $name)->first();
            if ($r) {
                $res = $r->value;
            }
        }

        return $res;
    }

    public static function notification_channels()
    {
        return [
            "app_notification" => "App Notification (Inside App)",
            "push_notification" => "Push Notification (Pop Up)",
            "all" => "All Channels",
        ];
    }
}
