<?php

namespace Config;

use CodeIgniter\Config\BaseService;
use App\Services\Auth\GoogleService;
use App\Services\Auth\LocalService;
use App\Services\BoardService;
use App\Services\MylogService;
use App\Services\PaymentService;
use App\Services\UserService;
use App\Services\Customer\ClientService;
use App\Services\Customer\Wallet\CouponService;
use App\Services\Customer\Wallet\PointService;
use App\Services\Customer\Wallet\AccountService;
use App\Services\Customer\ServiceService;
use App\Services\Equipment\LineService;
use App\Services\Equipment\ServerPartService;
use App\Services\Equipment\ServerService;
use App\Services\Equipment\CHASSISService;
use App\Services\Part\CPUService;
use App\Services\Part\CSService;
use App\Services\Part\DISKService;
use App\Services\Part\IPService;
use App\Services\Part\RAMService;
use App\Services\Part\SOFTWAREService;
use App\Services\Part\SWITCHService;

/**
 * Services Configuration file.
 *
 * Services are simply other classes/libraries that the system uses
 * to do its job. This is used by CodeIgniter to allow the core of the
 * framework to be swapped out easily without affecting the usage within
 * the rest of your application.
 *
 * This file holds any application-specific services, or service overrides
 * that you might need. An example has been included with the general
 * method format you should use for your service methods. For more examples,
 * see the core Services file at system/Config/Services.php.
 */
class Services extends BaseService
{
    /*
     * public static function example($getShared = true)
     * {
     *     if ($getShared) {
     *         return static::getSharedInstance('example');
     *     }
     *
     *     return new \CodeIgniter\Example();
     * }
     */
    //로그인정보요
    public static function myauth($getShared = true): LocalService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        } else {
            return new LocalService(
                new \App\Models\UserModel()
            );
        }
    }
    //로그인처리용
    public static function localauth($getShared = true): LocalService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        } else {
            return new LocalService(
                new \App\Models\UserModel()
            );
        }
    }
    public static function googleauth($getShared = true): GoogleService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new GoogleService(
            new \App\Models\USerModel(),
            new \App\Libraries\MySocket\GoogleSocket\CURL()
        );
    }
    //로그인처리용
    public static function userservice($getShared = true): UserService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new UserService(
            new \App\Models\USerModel()
        );
    }
    public static function mylogservice($getShared = true): MylogService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new MylogService(
            new \App\Models\MylogModel(),
        );
    }
    public static function boardservice($getShared = true): BoardService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new BoardService(
            new \App\Models\BoardModel(),
        );
    }
    public static function paymentservice($getShared = true): PaymentService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new PaymentService(
            new \App\Models\PaymentModel(),
        );
    }
    //Customer
    public static function customer_clientservice($getShared = true): ClientService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new ClientService(
            new \App\Models\Customer\ClientModel(),
        );
    }
    public static function customer_wallet_accountservice($getShared = true): AccountService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new AccountService(
            new \App\Models\Customer\Wallet\AccountModel(),
        );
    }
    public static function customer_wallet_couponservice($getShared = true): CouponService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new CouponService(
            new \App\Models\Customer\Wallet\CouponModel(),
        );
    }
    public static function customer_wallet_pointservice($getShared = true): PointService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new PointService(
            new \App\Models\Customer\Wallet\PointModel(),
        );
    }
    public static function customer_serviceservice($getShared = true): ServiceService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new ServiceService(
            new \App\Models\Customer\ServiceModel(),
        );
    }
    //Equipment
    public static function equipment_lineservice($getShared = true): LineService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new LineService(
            new \App\Models\Equipment\LineModel(),
        );
    }
    public static function equipment_serverservice($getShared = true): ServerService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new ServerService(
            new \App\Models\Equipment\ServerModel(),
        );
    }
    public static function equipment_serverpartservice($getShared = true): ServerPartService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new ServerPartService(
            new \App\Models\Equipment\ServerPartModel(),
        );
    }
    //Part
    public static function equipment_chassisservice($getShared = true): CHASSISService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new CHASSISService(
            new \App\Models\Equipment\CHASSISModel(),
        );
    }
    public static function part_cpuservice($getShared = true): CPUService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new CPUService(
            new \App\Models\Part\CPUModel(),
        );
    }
    public static function part_ramservice($getShared = true): RAMService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new RAMService(
            new \App\Models\Part\RAMModel(),
        );
    }
    public static function part_diskservice($getShared = true): DISKService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new DISKService(
            new \App\Models\Part\DISKModel(),
        );
    }
    public static function part_softwareservice($getShared = true): SOFTWAREService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new SOFTWAREService(
            new \App\Models\Part\SOFTWAREModel(),
        );
    }
    public static function part_switchservice($getShared = true): SWITCHService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new SWITCHService(
            new \App\Models\Part\SWITCHModel(),
        );
    }
    public static function part_ipservice($getShared = true): IPService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new IPService(
            new \App\Models\Part\IPModel(),
        );
    }
    public static function part_csservice($getShared = true): CSService
    {
        if ($getShared) {
            return static::getSharedInstance(__FUNCTION__);
        }
        return new CSService(
            new \App\Models\Part\CSModel(),
        );
    }
}
