<?php
/*
 * PagarmeCoreApiLib
 *
 * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
 */

namespace PagarmeCoreApiLib\Models;

use JsonSerializable;
use PagarmeCoreApiLib\Utils\DateTimeHelper;

/**
 *Token data
 */
class GetTokenResponse implements JsonSerializable
{
    /**
     * @todo Write general description for this property
     * @required
     * @var string $id public property
     */
    public $id;

    /**
     * @todo Write general description for this property
     * @required
     * @var string $type public property
     */
    public $type;

    /**
     * @todo Write general description for this property
     * @required
     * @maps created_at
     * @factory \PagarmeCoreApiLib\Utils\DateTimeHelper::fromRfc3339DateTime
     * @var \DateTime $createdAt public property
     */
    public $createdAt;

    /**
     * @todo Write general description for this property
     * @required
     * @maps expires_at
     * @var string $expiresAt public property
     */
    public $expiresAt;

    /**
     * @todo Write general description for this property
     * @required
     * @var \PagarmeCoreApiLib\Models\GetCardTokenResponse $card public property
     */
    public $card;

    /**
     * Constructor to set initial or default values of member properties
     * @param string                $id        Initialization value for $this->id
     * @param string                $type      Initialization value for $this->type
     * @param \DateTime             $createdAt Initialization value for $this->createdAt
     * @param string                $expiresAt Initialization value for $this->expiresAt
     * @param GetCardTokenResponse  $card      Initialization value for $this->card
     */
    public function __construct()
    {
        if (5 == func_num_args()) {
            $this->id        = func_get_arg(0);
            $this->type      = func_get_arg(1);
            $this->createdAt = func_get_arg(2);
            $this->expiresAt = func_get_arg(3);
            $this->card      = func_get_arg(4);
        }
    }


    /**
     * Encode this object to JSON
     */
    public function jsonSerialize()
    {
        $json = array();
        $json['id']         = $this->id;
        $json['type']       = $this->type;
        $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt);
        $json['expires_at'] = $this->expiresAt;
        $json['card']       = $this->card;

        return $json;
    }
}
