<?php

namespace App\Classes\Modules\Affiliate\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Affiliate\DataTransferObjects\AffiliateObject;
use App\Models\Affiliate;

class UpdatesAffiliate extends AbstractUpdateRecord
{
    /**
     * @param Affiliate $model
     * @param AffiliateObject $object
     * @return \Illuminate\Database\Eloquent\Model
     * @throws \App\Classes\Exceptions\MalformedRequestException
     */
    public function execute(Affiliate $model, AffiliateObject $object)
    {
        // Don't update code if it already exists
        $model->campaign_name = $object->getCampaignName();
        $model->campaign_description = $object->getCampaignDescription();
        $model->is_active = $object->getIsActive();

        return $this->handler($model);
    }
}

