<?php

namespace App\Classes\Modules\Accounts\Services;

use App\Classes\ValueObjects\Constants\BusinessType;
use App\Classes\ValueObjects\Constants\RoleTypes;
use App\Models\User;

class AuthenticationRedirect
{

    public function url(User $user){

        if($user->type === RoleTypes::USER){

            if (in_array($user->companyModule()->first()->type, [BusinessType::ONLINE_SELLER, BusinessType::LAST_MILE_DELIVERY_AGENT])) {
                return route('last_mile_delivery.dashboard');
            }

            return route('dashboard');
        }

        return route('dashboard');
    }

}