<?php

namespace Devurai\AcceptbluePaymentPro\Order\level_2;

class ShippingInfo extends BaseInfo
{

    public function getFirstName(): string {
        return $this->getOrderFieldValue('first_name');
    }

    public function getLastName(): string {
        return $this->getOrderFieldValue('last_name');
    }

    public function getFullName(): string {
        return trim($this->getFirstName() . " " . $this->getLastName());
    }

    public function getEmail(): string {
        return $this->getOrderFieldValue('email');
    }

    public function getPhone(): string {
        return $this->getOrderFieldValue('phone');
    }

    public function getAddress(): string {
        return $this->getOrderFieldValue('address_1');
    }

    public function getAddress2(): string {
        return $this->getOrderFieldValue('address_2');
    }

    public function getCity(): string {
        return $this->getOrderFieldValue('city');
    }

    public function getState(): string {
        return $this->getOrderFieldValue('state');
    }

    public function getZip(): string {
        return $this->getOrderFieldValue('postcode');
    }

    public function getCountry(): string {
        return $this->getOrderFieldValue('country');
    }

    public function getShippingFields(): \stdClass
    {
        return (object) array(
            'first_name' => $this->getOrderFieldValue('first_name'),
            'last_name' => $this->getOrderFieldValue('last_name'),
            'street' => $this->getOrderFieldValue('address_1'),
            'street2' => $this->getOrderFieldValue('address_2'),
            'city' => $this->getOrderFieldValue('city'),
            'state' => $this->getOrderFieldValue('state'),
            'zip' => $this->getOrderFieldValue('postcode'),
            'country' => $this->getOrderFieldValue('country'),
        );
    }

    protected function getType(): string
    {
        return 'shipping';
    }
}