<?php

namespace App\Classes\Modules\Segments\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Segments\DataTransferObjects\SeasonalSegmentObject;
use App\Models\SeasonalSegment;
use App\Models\Company;

class CreatesSeasonalSegment extends AbstractUpdateRecord
{
    /**
     * @param SeasonalSegmentObject $object
     * @return \Illuminate\Database\Eloquent\Model
     * @throws \App\Classes\Exceptions\MalformedRequestException
     */
    public function execute(SeasonalSegmentObject $object) {
        $model = new SeasonalSegment();
        $model->company_id = $object->getCompanyId();
        $model->segment_id = $object->getSegmentId();
        $model->starting_on = $object->getStartingOn();
        $model->ending_on = $object->getEndingOn();

        return $this->handler($model);

    }
}