<?php

namespace App\Http\Controllers;

use App\Models\User;
use Illuminate\Http\Request;
use App\Http\Requests\CreateCouponRequest;
use App\Http\Requests\ValidateCoupon;
use App\Models\Coupon;
class CouponController extends Controller
{
    /**
     * @var bool
     */
    private bool $api_call;
    /**
     * @brief assign true|false to $api_call by checking if the request is an API call
     *
     * @return void
     */
    public function __construct() {
        $this->api_call = request()->header('Accept') == "application/json";
    }
    public function index() {
        if (isAdmin()) {
            return view("v1/02_dash-template/admin-pages/coupons",['users'=>User::where('id', '<>', auth()->user()->id)->get(), 'coupons'=>Coupon::where('id', '<>', auth()->user()->id)->get()]);
        } else
            abort(401);
    }

    public function editCouponPolicies() {

    }
    public function createCoupon(CreateCouponRequest $request) {
        if (isAdmin()) {

        } else
            abort(401);
    }

    public function editOrDeleteCoupon(ValidateCoupon $request) {

    }

    public function validateOrUseCoupon(ValidateCoupon $request) {

    }
}
