<?php
/**
 * PaymentService
 *
 * PHP version 7.4
 *
 * @category Class
 * @package  Xero2\Accounting
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * Xero Accounting API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 2.10.0
 * Contact: api@xero.com
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 6.0.0
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Xero2\Accounting\Model;

use \ArrayAccess;
use \Xero2\Accounting\ObjectSerializer;

/**
 * PaymentService Class Doc Comment
 *
 * @category Class
 * @package  Xero2\Accounting
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<TKey, TValue>
 * @template TKey int|null
 * @template TValue mixed|null
 */
class PaymentService implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $openAPIModelName = 'PaymentService';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'payment_service_id' => 'string',
        'payment_service_name' => 'string',
        'payment_service_url' => 'string',
        'pay_now_text' => 'string',
        'payment_service_type' => 'string',
        'validation_errors' => '\Xero2\Accounting\Model\ValidationError[]'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      * @phpstan-var array<string, string|null>
      * @psalm-var array<string, string|null>
      */
    protected static $openAPIFormats = [
        'payment_service_id' => 'uuid',
        'payment_service_name' => null,
        'payment_service_url' => null,
        'pay_now_text' => null,
        'payment_service_type' => null,
        'validation_errors' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function openAPITypes()
    {
        return self::$openAPITypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function openAPIFormats()
    {
        return self::$openAPIFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'payment_service_id' => 'PaymentServiceID',
        'payment_service_name' => 'PaymentServiceName',
        'payment_service_url' => 'PaymentServiceUrl',
        'pay_now_text' => 'PayNowText',
        'payment_service_type' => 'PaymentServiceType',
        'validation_errors' => 'ValidationErrors'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'payment_service_id' => 'setPaymentServiceId',
        'payment_service_name' => 'setPaymentServiceName',
        'payment_service_url' => 'setPaymentServiceUrl',
        'pay_now_text' => 'setPayNowText',
        'payment_service_type' => 'setPaymentServiceType',
        'validation_errors' => 'setValidationErrors'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'payment_service_id' => 'getPaymentServiceId',
        'payment_service_name' => 'getPaymentServiceName',
        'payment_service_url' => 'getPaymentServiceUrl',
        'pay_now_text' => 'getPayNowText',
        'payment_service_type' => 'getPaymentServiceType',
        'validation_errors' => 'getValidationErrors'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$openAPIModelName;
    }


    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['payment_service_id'] = $data['payment_service_id'] ?? null;
        $this->container['payment_service_name'] = $data['payment_service_name'] ?? null;
        $this->container['payment_service_url'] = $data['payment_service_url'] ?? null;
        $this->container['pay_now_text'] = $data['pay_now_text'] ?? null;
        $this->container['payment_service_type'] = $data['payment_service_type'] ?? null;
        $this->container['validation_errors'] = $data['validation_errors'] ?? null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets payment_service_id
     *
     * @return string|null
     */
    public function getPaymentServiceId()
    {
        return $this->container['payment_service_id'];
    }

    /**
     * Sets payment_service_id
     *
     * @param string|null $payment_service_id Xero identifier
     *
     * @return self
     */
    public function setPaymentServiceId($payment_service_id)
    {
        $this->container['payment_service_id'] = $payment_service_id;

        return $this;
    }

    /**
     * Gets payment_service_name
     *
     * @return string|null
     */
    public function getPaymentServiceName()
    {
        return $this->container['payment_service_name'];
    }

    /**
     * Sets payment_service_name
     *
     * @param string|null $payment_service_name Name of payment service
     *
     * @return self
     */
    public function setPaymentServiceName($payment_service_name)
    {
        $this->container['payment_service_name'] = $payment_service_name;

        return $this;
    }

    /**
     * Gets payment_service_url
     *
     * @return string|null
     */
    public function getPaymentServiceUrl()
    {
        return $this->container['payment_service_url'];
    }

    /**
     * Sets payment_service_url
     *
     * @param string|null $payment_service_url The custom payment URL
     *
     * @return self
     */
    public function setPaymentServiceUrl($payment_service_url)
    {
        $this->container['payment_service_url'] = $payment_service_url;

        return $this;
    }

    /**
     * Gets pay_now_text
     *
     * @return string|null
     */
    public function getPayNowText()
    {
        return $this->container['pay_now_text'];
    }

    /**
     * Sets pay_now_text
     *
     * @param string|null $pay_now_text The text displayed on the Pay Now button in Xero Online Invoicing. If this is not set it will default to Pay by credit card
     *
     * @return self
     */
    public function setPayNowText($pay_now_text)
    {
        $this->container['pay_now_text'] = $pay_now_text;

        return $this;
    }

    /**
     * Gets payment_service_type
     *
     * @return string|null
     */
    public function getPaymentServiceType()
    {
        return $this->container['payment_service_type'];
    }

    /**
     * Sets payment_service_type
     *
     * @param string|null $payment_service_type This will always be CUSTOM for payment services created via the API.
     *
     * @return self
     */
    public function setPaymentServiceType($payment_service_type)
    {
        $this->container['payment_service_type'] = $payment_service_type;

        return $this;
    }

    /**
     * Gets validation_errors
     *
     * @return \Xero2\Accounting\Model\ValidationError[]|null
     */
    public function getValidationErrors()
    {
        return $this->container['validation_errors'];
    }

    /**
     * Sets validation_errors
     *
     * @param \Xero2\Accounting\Model\ValidationError[]|null $validation_errors Displays array of validation error messages from the API
     *
     * @return self
     */
    public function setValidationErrors($validation_errors)
    {
        $this->container['validation_errors'] = $validation_errors;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    public function offsetExists($offset): bool
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed|null
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return $this->container[$offset] ?? null;
    }

    /**
     * Sets value based on offset.
     *
     * @param int|null $offset Offset
     * @param mixed    $value  Value to be set
     *
     * @return void
     */
    public function offsetSet($offset, $value): void
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    public function offsetUnset($offset): void
    {
        unset($this->container[$offset]);
    }

    /**
     * Serializes the object to a value that can be serialized natively by json_encode().
     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
     *
     * @return mixed Returns data which can be serialized by json_encode(), which is a value
     * of any type other than a resource.
     */
    #[\ReturnTypeWillChange]
    public function jsonSerialize()
    {
       return ObjectSerializer::sanitizeForSerialization($this);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        return json_encode(
            ObjectSerializer::sanitizeForSerialization($this),
            JSON_PRETTY_PRINT
        );
    }

    /**
     * Gets a header-safe presentation of the object
     *
     * @return string
     */
    public function toHeaderValue()
    {
        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}


