<?php


namespace App\Services;


use App\Batch;
use App\StationRuleBatch;
use App\StationType;

class StationTypeService
{
    /** @var StationRuleBatchService $stationRuleBatchService */
    private $stationRuleBatchService;
    public function __construct()
    {
        $this->stationRuleBatchService=null;
    }

    function getByBatch(Batch $batch): StationType
    {
        $this->stationRuleBatchService=app('StationRuleBatchService');
        $stationRuleBatch=$this->stationRuleBatchService->getByBatch($batch);
        return $stationRuleBatch['stationType'];
    }
    function getForCommodity(): StationType
    {
        /** @var StationType $stationType */
        $stationType= StationType::query()->firstOrCreate(['name'=>'料箱监视器']);
        return $stationType;
    }
    function getForMaterialBox(): StationType
    {
        /** @var StationType $stationType */
        $stationType= StationType::query()->firstOrCreate(['name'=>'料箱监视器']);
        return $stationType;
    }
}
