<?php
/**
 * PaymentsGetPaymentStatus200Response
 *
 * PHP version 8.1
 *
 * @category Class
 * @package  Simplyin\Simplyin_W_Plugin\Lib\Remote\SimplyInApi
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * Simply.in API
 *
 * Swagger documentation for SIMPLY.IN
 *
 * The version of the OpenAPI document: 1.100.10 (dev)
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.17.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 Simplyin\Simplyin_W_Plugin\Lib\Remote\SimplyInApi\Model;

use \ArrayAccess;
use \Simplyin\Simplyin_W_Plugin\Lib\Remote\SimplyInApi\ObjectSerializer;

/**
 * PaymentsGetPaymentStatus200Response Class Doc Comment
 *
 * @category Class
 * @package  Simplyin\Simplyin_W_Plugin\Lib\Remote\SimplyInApi
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<string, mixed>
 */
class PaymentsGetPaymentStatus200Response implements ModelInterface, ArrayAccess, \JsonSerializable {

	public const DISCRIMINATOR = null;

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

	/**
	 * Array of property to type mappings. Used for (de)serialization
	 *
	 * @var string[]
	 */
	protected static $openAPITypes = [
		'payment_method_id'     => 'string',
		'payment_provider_id'   => 'string',
		'payment_provider_type' => 'string',
		'merchant_payment_id'   => 'string',
		'provider_payment_id'   => 'string',
		'title'                 => 'string',
		'amount'                => 'float',
		'currency'              => 'string',
		'status'                => 'string',
	];

	/**
	 * 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_method_id'     => null,
		'payment_provider_id'   => null,
		'payment_provider_type' => null,
		'merchant_payment_id'   => null,
		'provider_payment_id'   => null,
		'title'                 => null,
		'amount'                => null,
		'currency'              => null,
		'status'                => null,
	];

	/**
	 * Array of nullable properties. Used for (de)serialization
	 *
	 * @var boolean[]
	 */
	protected static array $openAPINullables = [
		'payment_method_id'     => false,
		'payment_provider_id'   => false,
		'payment_provider_type' => false,
		'merchant_payment_id'   => false,
		'provider_payment_id'   => false,
		'title'                 => false,
		'amount'                => false,
		'currency'              => false,
		'status'                => false,
	];

	/**
	 * If a nullable field gets set to null, insert it here
	 *
	 * @var boolean[]
	 */
	protected array $openAPINullablesSetToNull = [];

	/**
	 * 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 nullable properties
	 *
	 * @return array
	 */
	protected static function openAPINullables(): array {
		return self::$openAPINullables;
	}

	/**
	 * Array of nullable field names deliberately set to null
	 *
	 * @return boolean[]
	 */
	private function getOpenAPINullablesSetToNull(): array {
		return $this->openAPINullablesSetToNull;
	}

	/**
	 * Setter - Array of nullable field names deliberately set to null
	 *
	 * @param boolean[] $openAPINullablesSetToNull
	 */
	private function setOpenAPINullablesSetToNull(
		array $openAPINullablesSetToNull
	): void {
		$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
	}

	/**
	 * Checks if a property is nullable
	 *
	 * @param string $property
	 *
	 * @return bool
	 */
	public static function isNullable( string $property ): bool {
		return self::openAPINullables()[ $property ] ?? false;
	}

	/**
	 * Checks if a nullable property is set to null.
	 *
	 * @param string $property
	 *
	 * @return bool
	 */
	public function isNullableSetToNull( string $property ): bool {
		return in_array( $property,
			$this->getOpenAPINullablesSetToNull(),
			true );
	}

	/**
	 * Array of attributes where the key is the local name,
	 * and the value is the original name
	 *
	 * @var string[]
	 */
	protected static $attributeMap = [
		'payment_method_id'     => 'paymentMethodId',
		'payment_provider_id'   => 'paymentProviderId',
		'payment_provider_type' => 'paymentProviderType',
		'merchant_payment_id'   => 'merchantPaymentId',
		'provider_payment_id'   => 'providerPaymentId',
		'title'                 => 'title',
		'amount'                => 'amount',
		'currency'              => 'currency',
		'status'                => 'status',
	];

	/**
	 * Array of attributes to setter functions (for deserialization of responses)
	 *
	 * @var string[]
	 */
	protected static $setters = [
		'payment_method_id'     => 'setPaymentMethodId',
		'payment_provider_id'   => 'setPaymentProviderId',
		'payment_provider_type' => 'setPaymentProviderType',
		'merchant_payment_id'   => 'setMerchantPaymentId',
		'provider_payment_id'   => 'setProviderPaymentId',
		'title'                 => 'setTitle',
		'amount'                => 'setAmount',
		'currency'              => 'setCurrency',
		'status'                => 'setStatus',
	];

	/**
	 * Array of attributes to getter functions (for serialization of requests)
	 *
	 * @var string[]
	 */
	protected static $getters = [
		'payment_method_id'     => 'getPaymentMethodId',
		'payment_provider_id'   => 'getPaymentProviderId',
		'payment_provider_type' => 'getPaymentProviderType',
		'merchant_payment_id'   => 'getMerchantPaymentId',
		'provider_payment_id'   => 'getProviderPaymentId',
		'title'                 => 'getTitle',
		'amount'                => 'getAmount',
		'currency'              => 'getCurrency',
		'status'                => 'getStatus',
	];

	/**
	 * 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;
	}

	public const STATUS_PENDING = 'PENDING';

	public const STATUS_PAID = 'PAID';

	public const STATUS_CANCELED = 'CANCELED';

	public const STATUS_REJECTED = 'REJECTED';

	public const STATUS_REFUNDED = 'REFUNDED';

	/**
	 * Gets allowable values of the enum
	 *
	 * @return string[]
	 */
	public function getStatusAllowableValues() {
		return [
			self::STATUS_PENDING,
			self::STATUS_PAID,
			self::STATUS_CANCELED,
			self::STATUS_REJECTED,
			self::STATUS_REFUNDED,
		];
	}

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

	/**
	 * Constructor
	 *
	 * @param mixed[]|null $data Associated array of property values
	 *                      initializing the model
	 */
	public function __construct( ?array $data = null ) {
		$this->setIfExists( 'payment_method_id', $data ?? [], null );
		$this->setIfExists( 'payment_provider_id', $data ?? [], null );
		$this->setIfExists( 'payment_provider_type', $data ?? [], null );
		$this->setIfExists( 'merchant_payment_id', $data ?? [], null );
		$this->setIfExists( 'provider_payment_id', $data ?? [], null );
		$this->setIfExists( 'title', $data ?? [], null );
		$this->setIfExists( 'amount', $data ?? [], null );
		$this->setIfExists( 'currency', $data ?? [], null );
		$this->setIfExists( 'status', $data ?? [], null );
	}

	/**
	 * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
	 * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
	 * $this->openAPINullablesSetToNull array
	 *
	 * @param string $variableName
	 * @param array $fields
	 * @param mixed $defaultValue
	 */
	private function setIfExists(
		string $variableName,
		array $fields,
		$defaultValue
	): void {
		if ( self::isNullable( $variableName ) && array_key_exists( $variableName,
				$fields ) && is_null( $fields[ $variableName ] ) ) {
			$this->openAPINullablesSetToNull[] = $variableName;
		}

		$this->container[ $variableName ] = $fields[ $variableName ] ?? $defaultValue;
	}

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

		if ( $this->container['payment_method_id'] === null ) {
			$invalidProperties[] = "'payment_method_id' can't be null";
		}
		if ( $this->container['payment_provider_id'] === null ) {
			$invalidProperties[] = "'payment_provider_id' can't be null";
		}
		if ( $this->container['payment_provider_type'] === null ) {
			$invalidProperties[] = "'payment_provider_type' can't be null";
		}
		if ( $this->container['merchant_payment_id'] === null ) {
			$invalidProperties[] = "'merchant_payment_id' can't be null";
		}
		if ( $this->container['provider_payment_id'] === null ) {
			$invalidProperties[] = "'provider_payment_id' can't be null";
		}
		if ( $this->container['title'] === null ) {
			$invalidProperties[] = "'title' can't be null";
		}
		if ( $this->container['amount'] === null ) {
			$invalidProperties[] = "'amount' can't be null";
		}
		if ( $this->container['currency'] === null ) {
			$invalidProperties[] = "'currency' can't be null";
		}
		if ( $this->container['status'] === null ) {
			$invalidProperties[] = "'status' can't be null";
		}
		$allowedValues = $this->getStatusAllowableValues();
		if ( ! is_null( $this->container['status'] ) && ! in_array( $this->container['status'],
				$allowedValues,
				true ) ) {
			$invalidProperties[] = sprintf(
				"invalid value '%s' for 'status', must be one of '%s'",
				$this->container['status'],
				implode( "', '", $allowedValues )
			);
		}

		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_method_id
	 *
	 * @return string
	 */
	public function getPaymentMethodId() {
		return $this->container['payment_method_id'];
	}

	/**
	 * Sets payment_method_id
	 *
	 * @param string $payment_method_id payment_method_id
	 *
	 * @return self
	 */
	public function setPaymentMethodId( $payment_method_id ) {
		if ( is_null( $payment_method_id ) ) {
			throw new \InvalidArgumentException( 'non-nullable payment_method_id cannot be null' );
		}
		$this->container['payment_method_id'] = $payment_method_id;

		return $this;
	}

	/**
	 * Gets payment_provider_id
	 *
	 * @return string
	 */
	public function getPaymentProviderId() {
		return $this->container['payment_provider_id'];
	}

	/**
	 * Sets payment_provider_id
	 *
	 * @param string $payment_provider_id payment_provider_id
	 *
	 * @return self
	 */
	public function setPaymentProviderId( $payment_provider_id ) {
		if ( is_null( $payment_provider_id ) ) {
			throw new \InvalidArgumentException( 'non-nullable payment_provider_id cannot be null' );
		}
		$this->container['payment_provider_id'] = $payment_provider_id;

		return $this;
	}

	/**
	 * Gets payment_provider_type
	 *
	 * @return string
	 */
	public function getPaymentProviderType() {
		return $this->container['payment_provider_type'];
	}

	/**
	 * Sets payment_provider_type
	 *
	 * @param string $payment_provider_type payment_provider_type
	 *
	 * @return self
	 */
	public function setPaymentProviderType( $payment_provider_type ) {
		if ( is_null( $payment_provider_type ) ) {
			throw new \InvalidArgumentException( 'non-nullable payment_provider_type cannot be null' );
		}
		$this->container['payment_provider_type'] = $payment_provider_type;

		return $this;
	}

	/**
	 * Gets merchant_payment_id
	 *
	 * @return string
	 */
	public function getMerchantPaymentId() {
		return $this->container['merchant_payment_id'];
	}

	/**
	 * Sets merchant_payment_id
	 *
	 * @param string $merchant_payment_id merchant_payment_id
	 *
	 * @return self
	 */
	public function setMerchantPaymentId( $merchant_payment_id ) {
		if ( is_null( $merchant_payment_id ) ) {
			throw new \InvalidArgumentException( 'non-nullable merchant_payment_id cannot be null' );
		}
		$this->container['merchant_payment_id'] = $merchant_payment_id;

		return $this;
	}

	/**
	 * Gets provider_payment_id
	 *
	 * @return string
	 */
	public function getProviderPaymentId() {
		return $this->container['provider_payment_id'];
	}

	/**
	 * Sets provider_payment_id
	 *
	 * @param string $provider_payment_id provider_payment_id
	 *
	 * @return self
	 */
	public function setProviderPaymentId( $provider_payment_id ) {
		if ( is_null( $provider_payment_id ) ) {
			throw new \InvalidArgumentException( 'non-nullable provider_payment_id cannot be null' );
		}
		$this->container['provider_payment_id'] = $provider_payment_id;

		return $this;
	}

	/**
	 * Gets title
	 *
	 * @return string
	 */
	public function getTitle() {
		return $this->container['title'];
	}

	/**
	 * Sets title
	 *
	 * @param string $title title
	 *
	 * @return self
	 */
	public function setTitle( $title ) {
		if ( is_null( $title ) ) {
			throw new \InvalidArgumentException( 'non-nullable title cannot be null' );
		}
		$this->container['title'] = $title;

		return $this;
	}

	/**
	 * Gets amount
	 *
	 * @return float
	 */
	public function getAmount() {
		return $this->container['amount'];
	}

	/**
	 * Sets amount
	 *
	 * @param float $amount amount
	 *
	 * @return self
	 */
	public function setAmount( $amount ) {
		if ( is_null( $amount ) ) {
			throw new \InvalidArgumentException( 'non-nullable amount cannot be null' );
		}
		$this->container['amount'] = $amount;

		return $this;
	}

	/**
	 * Gets currency
	 *
	 * @return string
	 */
	public function getCurrency() {
		return $this->container['currency'];
	}

	/**
	 * Sets currency
	 *
	 * @param string $currency currency
	 *
	 * @return self
	 */
	public function setCurrency( $currency ) {
		if ( is_null( $currency ) ) {
			throw new \InvalidArgumentException( 'non-nullable currency cannot be null' );
		}
		$this->container['currency'] = $currency;

		return $this;
	}

	/**
	 * Gets status
	 *
	 * @return string
	 */
	public function getStatus() {
		return $this->container['status'];
	}

	/**
	 * Sets status
	 *
	 * @param string $status status
	 *
	 * @return self
	 */
	public function setStatus( $status ) {
		if ( is_null( $status ) ) {
			throw new \InvalidArgumentException( 'non-nullable status cannot be null' );
		}
		$allowedValues = $this->getStatusAllowableValues();
		if ( ! in_array( $status, $allowedValues, true ) ) {
			throw new \InvalidArgumentException(
				sprintf(
					"Invalid value '%s' for 'status', must be one of '%s'",
					esc_html( $status ),
					implode( "', '", [] )
				)
			);
		}
		$this->container['status'] = $status;

		return $this;
	}

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

	/**
	 * Gets offset.
	 *
	 * @param integer|string $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|string $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 ) );
	}
}
