<?php

namespace App\Http\Controllers\API;

use App\Http\Controllers\Controller;
use App\Interfaces\MemberRepositoryInterface;
use Illuminate\Http\Request;

class AuthAPIController extends Controller
{
    protected $member;

    public function __construct(
        MemberRepositoryInterface $memberRepo
    ) {
        $this->member = $memberRepo;
    }

    public function status(Request $request)
    {
        $result = [];
        $data   = json_decode($request->getContent());
        if ($this->member::status()) {
            $result = [
                'message' => 'Authorized',
                'type'    => 'apiUseAuthorized',
                'token'   => session('token'),
            ];
        } else {
            $result = [
                'message' => 'Not Authorized',
                'type'    => 'apiUseNotAuthorized',
            ];
        }

        return response()->json($result);
    }
}