<?php

namespace App\Classes\Modules\Addresses\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord;
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
use App\Models\Order;
use App\Models\Address;

class CreatesOrderAddress extends AbstractUpdateRelationshipRecord
{

    public function execute(Address $address, Order $order) {

        $model = new Address();
        $model->street_one = $address->street_one;
        $model->street_two = $address->street_two;
        $model->country_id = $address->country_id;
        $model->state_id = $address->state_id;
        $model->district_id = $address->district_id;
        $model->postcode = $address->postcode;

        return $this->handler($order->addresses(), $model);

    }
}
