<?php

// File generated from our OpenAPI spec
namespace StripeWPFS\Stripe\Tax;

/**
 * A Tax <code>Registration</code> lets us know that your business is registered to collect tax on payments within a region, enabling you to <a href="https://stripe.com/docs/tax">automatically collect tax</a>.
 *
 * Stripe doesn't register on your behalf with the relevant authorities when you create a Tax <code>Registration</code> object. For more information on how to register to collect tax, see <a href="https://stripe.com/docs/tax/registering">our guide</a>.
 *
 * Related guide: <a href="https://stripe.com/docs/tax/registrations-api">Using the Registrations API</a>
 *
 * @property string $id Unique identifier for the object.
 * @property string $object String representing the object's type. Objects of the same type share the same value.
 * @property int $active_from Time at which the registration becomes active. Measured in seconds since the Unix epoch.
 * @property string $country Two-letter country code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>).
 * @property (object{ae?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), al?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), am?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), ao?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), at?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), au?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), aw?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), az?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), ba?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), bb?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), bd?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), be?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), bf?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), bg?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), bh?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), bj?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), bs?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), by?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), ca?: (object{province_standard?: (object{province: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), cd?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), ch?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), cl?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), cm?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), co?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), cr?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), cv?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), cy?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), cz?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), de?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), dk?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), ec?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), ee?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), eg?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), es?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), et?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), fi?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), fr?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), gb?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), ge?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), gn?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), gr?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), hr?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), hu?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), id?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), ie?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), in?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), is?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), it?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), jp?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), ke?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), kg?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), kh?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), kr?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), kz?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), la?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), lt?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), lu?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), lv?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), ma?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), md?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), me?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), mk?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), mr?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), mt?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), mx?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), my?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), ng?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), nl?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), no?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), np?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), nz?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), om?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), pe?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), ph?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), pl?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), pt?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), ro?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), rs?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), ru?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), sa?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), se?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), sg?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), si?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), sk?: (object{standard?: (object{place_of_supply_scheme: string}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), sn?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), sr?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), th?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), tj?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), tr?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), tz?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), ua?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), ug?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), us?: (object{local_amusement_tax?: (object{jurisdiction: string}&\StripeWPFS\Stripe\StripeObject), local_lease_tax?: (object{jurisdiction: string}&\StripeWPFS\Stripe\StripeObject), state: string, state_sales_tax?: (object{elections?: (object{jurisdiction?: string, type: string}&\StripeWPFS\Stripe\StripeObject)[]}&\StripeWPFS\Stripe\StripeObject), type: string}&\StripeWPFS\Stripe\StripeObject), uy?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), uz?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), vn?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), za?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), zm?: (object{type: string}&\StripeWPFS\Stripe\StripeObject), zw?: (object{type: string}&\StripeWPFS\Stripe\StripeObject)}&\StripeWPFS\Stripe\StripeObject) $country_options
 * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
 * @property null|int $expires_at If set, the registration stops being active at this time. If not set, the registration will be active indefinitely. Measured in seconds since the Unix epoch.
 * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
 * @property string $status The status of the registration. This field is present for convenience and can be deduced from <code>active_from</code> and <code>expires_at</code>.
 */
class Registration extends \StripeWPFS\Stripe\ApiResource
{
    const OBJECT_NAME = 'tax.registration';
    use \StripeWPFS\Stripe\ApiOperations\Update;
    const STATUS_ACTIVE = 'active';
    const STATUS_EXPIRED = 'expired';
    const STATUS_SCHEDULED = 'scheduled';
    /**
     * Creates a new Tax <code>Registration</code> object.
     *
     * @param null|array{active_from: array|int|string, country: string, country_options: array{ae?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, al?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, am?: array{type: string}, ao?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, at?: array{standard?: array{place_of_supply_scheme: string}, type: string}, au?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, aw?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, az?: array{type: string}, ba?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, bb?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, bd?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, be?: array{standard?: array{place_of_supply_scheme: string}, type: string}, bf?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, bg?: array{standard?: array{place_of_supply_scheme: string}, type: string}, bh?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, bj?: array{type: string}, bs?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, by?: array{type: string}, ca?: array{province_standard?: array{province: string}, type: string}, cd?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, ch?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, cl?: array{type: string}, cm?: array{type: string}, co?: array{type: string}, cr?: array{type: string}, cv?: array{type: string}, cy?: array{standard?: array{place_of_supply_scheme: string}, type: string}, cz?: array{standard?: array{place_of_supply_scheme: string}, type: string}, de?: array{standard?: array{place_of_supply_scheme: string}, type: string}, dk?: array{standard?: array{place_of_supply_scheme: string}, type: string}, ec?: array{type: string}, ee?: array{standard?: array{place_of_supply_scheme: string}, type: string}, eg?: array{type: string}, es?: array{standard?: array{place_of_supply_scheme: string}, type: string}, et?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, fi?: array{standard?: array{place_of_supply_scheme: string}, type: string}, fr?: array{standard?: array{place_of_supply_scheme: string}, type: string}, gb?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, ge?: array{type: string}, gn?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, gr?: array{standard?: array{place_of_supply_scheme: string}, type: string}, hr?: array{standard?: array{place_of_supply_scheme: string}, type: string}, hu?: array{standard?: array{place_of_supply_scheme: string}, type: string}, id?: array{type: string}, ie?: array{standard?: array{place_of_supply_scheme: string}, type: string}, in?: array{type: string}, is?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, it?: array{standard?: array{place_of_supply_scheme: string}, type: string}, jp?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, ke?: array{type: string}, kg?: array{type: string}, kh?: array{type: string}, kr?: array{type: string}, kz?: array{type: string}, la?: array{type: string}, lt?: array{standard?: array{place_of_supply_scheme: string}, type: string}, lu?: array{standard?: array{place_of_supply_scheme: string}, type: string}, lv?: array{standard?: array{place_of_supply_scheme: string}, type: string}, ma?: array{type: string}, md?: array{type: string}, me?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, mk?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, mr?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, mt?: array{standard?: array{place_of_supply_scheme: string}, type: string}, mx?: array{type: string}, my?: array{type: string}, ng?: array{type: string}, nl?: array{standard?: array{place_of_supply_scheme: string}, type: string}, no?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, np?: array{type: string}, nz?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, om?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, pe?: array{type: string}, ph?: array{type: string}, pl?: array{standard?: array{place_of_supply_scheme: string}, type: string}, pt?: array{standard?: array{place_of_supply_scheme: string}, type: string}, ro?: array{standard?: array{place_of_supply_scheme: string}, type: string}, rs?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, ru?: array{type: string}, sa?: array{type: string}, se?: array{standard?: array{place_of_supply_scheme: string}, type: string}, sg?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, si?: array{standard?: array{place_of_supply_scheme: string}, type: string}, sk?: array{standard?: array{place_of_supply_scheme: string}, type: string}, sn?: array{type: string}, sr?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, th?: array{type: string}, tj?: array{type: string}, tr?: array{type: string}, tz?: array{type: string}, ua?: array{type: string}, ug?: array{type: string}, us?: array{local_amusement_tax?: array{jurisdiction: string}, local_lease_tax?: array{jurisdiction: string}, state: string, state_sales_tax?: array{elections: array{jurisdiction?: string, type: string}[]}, type: string}, uy?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, uz?: array{type: string}, vn?: array{type: string}, za?: array{standard?: array{place_of_supply_scheme?: string}, type: string}, zm?: array{type: string}, zw?: array{standard?: array{place_of_supply_scheme?: string}, type: string}}, expand?: string[], expires_at?: int} $params
     * @param null|array|string $options
     *
     * @return Registration the created resource
     *
     * @throws \StripeWPFS\Stripe\Exception\ApiErrorException if the request fails
     */
    public static function create($params = null, $options = null)
    {
        self::_validateParams($params);
        $url = static::classUrl();
        list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
        $obj = \StripeWPFS\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
        $obj->setLastResponse($response);
        return $obj;
    }
    /**
     * Returns a list of Tax <code>Registration</code> objects.
     *
     * @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string, status?: string} $params
     * @param null|array|string $opts
     *
     * @return \StripeWPFS\Stripe\Collection<Registration> of ApiResources
     *
     * @throws \StripeWPFS\Stripe\Exception\ApiErrorException if the request fails
     */
    public static function all($params = null, $opts = null)
    {
        $url = static::classUrl();
        return static::_requestPage($url, \StripeWPFS\Stripe\Collection::class, $params, $opts);
    }
    /**
     * Returns a Tax <code>Registration</code> object.
     *
     * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
     * @param null|array|string $opts
     *
     * @return Registration
     *
     * @throws \StripeWPFS\Stripe\Exception\ApiErrorException if the request fails
     */
    public static function retrieve($id, $opts = null)
    {
        $opts = \StripeWPFS\Stripe\Util\RequestOptions::parse($opts);
        $instance = new static($id, $opts);
        $instance->refresh();
        return $instance;
    }
    /**
     * Updates an existing Tax <code>Registration</code> object.
     *
     * A registration cannot be deleted after it has been created. If you wish to end a
     * registration you may do so by setting <code>expires_at</code>.
     *
     * @param string $id the ID of the resource to update
     * @param null|array{active_from?: array|int|string, expand?: string[], expires_at?: null|array|int|string} $params
     * @param null|array|string $opts
     *
     * @return Registration the updated resource
     *
     * @throws \StripeWPFS\Stripe\Exception\ApiErrorException if the request fails
     */
    public static function update($id, $params = null, $opts = null)
    {
        self::_validateParams($params);
        $url = static::resourceUrl($id);
        list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
        $obj = \StripeWPFS\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
        $obj->setLastResponse($response);
        return $obj;
    }
}