<?php

namespace App\Services\InventorySetup;

use App\Repositories\InventorySetup\SupplierRepositories;
use App\Rules\PhoneNumberValidationRules;
use Illuminate\Support\Facades\Validator;

class SupplierService
{

    /**
     * @var SupplierRepositories
     */
    private $systemRepositories;
    /**
     * AdminCourseService constructor.
     * @param SupplierRepositories $branchRepositories
     */
    public function __construct(SupplierRepositories $systemRepositories)
    {
        $this->systemRepositories = $systemRepositories;
    }

    /**
     * @param $request
     * @return mixed
     */
    public function getList($request)
    {
        return $this->systemRepositories->getList($request);
    }
    /**
     * @param $request
     * @return mixed
     */
    public function getAllList()
    {
        return $this->systemRepositories->getAllList();
    }
    public function getDashboardList($request)
    {
        return $this->systemRepositories->getDashboardList($request);
    }
     public function getDueList($request)
    {
        return $this->systemRepositories->getDueList($request);
    }
    /**
     * @param $request
     * @return mixed
     */
    public function statusUpdate($request, $id)
    {
        return $this->systemRepositories->statusUpdate($request, $id);
    }

    public function statusValidation($request)
    {
        return [
            'id'                   => 'required',
            'status'               => 'required',
        ];
    }
    /**
     * @param $request
     * @return array
     */
    public function storeValidation($request)
    {
        return [
            'name'                   => 'required|max:100|min:2',
            'phone'                   =>  'required|unique:customers,phone|phone:BD,INTERNATIONAL',
            'status'                 => 'nullable',
        ];
    }

    /**
     * @param $id
     * @return array
     */
    public function updateValidation($request, $id)
    {
        return [
            'name'                   => 'required|max:100|min:2',
            'status'                 => 'nullable',
            'phone'                  =>'required|unique:customers,phone|phone:BD,INTERNATIONAL,' . $id,   
        ];
    }

    /**
     * @param $request
     * @return \App\Models\Currency
     */
    public function store($request)
    {
        return $this->systemRepositories->store($request);
    }

    /**
     * @param $request
     * @return \App\Models\Currency
     */
    public function details($id)
    {

        return $this->systemRepositories->details($id);
    }


    /**
     * @param $request
     * @param $id
     */
    public function update($request, $id)
    {
        return $this->systemRepositories->update($request, $id);
    }




    /**
     * @param $request
     * @param $id
     */
    public function destroy($id)
    {
        return $this->systemRepositories->destroy($id);
    }
}
