<?php

// File generated from our OpenAPI spec
namespace InvizoSubscriptionsLiteVendor\Stripe\Terminal;

/**
 * A Location represents a grouping of readers.
 *
 * Related guide: <a href="https://docs.stripe.com/terminal/fleet/locations">Fleet management</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 (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&\InvizoSubscriptionsLiteVendor\Stripe\StripeObject) $address
 * @property null|(object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string, town: null|string}&\InvizoSubscriptionsLiteVendor\Stripe\StripeObject) $address_kana
 * @property null|(object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string, town: null|string}&\InvizoSubscriptionsLiteVendor\Stripe\StripeObject) $address_kanji
 * @property null|string $configuration_overrides The ID of a configuration that will be used to customize all readers in this location.
 * @property string $display_name The display name of the location.
 * @property null|string $display_name_kana The Kana variation of the display name of the location.
 * @property null|string $display_name_kanji The Kanji variation of the display name of the location.
 * @property bool $livemode If the object exists in live mode, the value is <code>true</code>. If the object exists in test mode, the value is <code>false</code>.
 * @property \InvizoSubscriptionsLiteVendor\Stripe\StripeObject $metadata Set of <a href="https://docs.stripe.com/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
 * @property null|string $phone The phone number of the location.
 */
class Location extends \InvizoSubscriptionsLiteVendor\Stripe\ApiResource
{
    const OBJECT_NAME = 'terminal.location';
    use \InvizoSubscriptionsLiteVendor\Stripe\ApiOperations\Update;
    /**
     * Creates a new <code>Location</code> object. For further details, including which
     * address fields are required in each country, see the <a
     * href="/docs/terminal/fleet/locations">Manage locations</a> guide.
     *
     * @param null|array{address?: array{city?: string, country: string, line1?: string, line2?: string, postal_code?: string, state?: string}, address_kana?: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string, town?: string}, address_kanji?: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string, town?: string}, configuration_overrides?: string, display_name?: string, display_name_kana?: string, display_name_kanji?: string, expand?: string[], metadata?: null|array<string, string>, phone?: string} $params
     * @param null|array|string $options
     *
     * @return Location the created resource
     *
     * @throws \InvizoSubscriptionsLiteVendor\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 = \InvizoSubscriptionsLiteVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
        $obj->setLastResponse($response);
        return $obj;
    }
    /**
     * Deletes a <code>Location</code> object.
     *
     * @param null|array $params
     * @param null|array|string $opts
     *
     * @return Location the deleted resource
     *
     * @throws \InvizoSubscriptionsLiteVendor\Stripe\Exception\ApiErrorException if the request fails
     */
    public function delete($params = null, $opts = null)
    {
        self::_validateParams($params);
        $url = $this->instanceUrl();
        list($response, $opts) = $this->_request('delete', $url, $params, $opts);
        $this->refreshFrom($response, $opts);
        return $this;
    }
    /**
     * Returns a list of <code>Location</code> objects.
     *
     * @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
     * @param null|array|string $opts
     *
     * @return \InvizoSubscriptionsLiteVendor\Stripe\Collection<Location> of ApiResources
     *
     * @throws \InvizoSubscriptionsLiteVendor\Stripe\Exception\ApiErrorException if the request fails
     */
    public static function all($params = null, $opts = null)
    {
        $url = static::classUrl();
        return static::_requestPage($url, \InvizoSubscriptionsLiteVendor\Stripe\Collection::class, $params, $opts);
    }
    /**
     * Retrieves a <code>Location</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 Location
     *
     * @throws \InvizoSubscriptionsLiteVendor\Stripe\Exception\ApiErrorException if the request fails
     */
    public static function retrieve($id, $opts = null)
    {
        $opts = \InvizoSubscriptionsLiteVendor\Stripe\Util\RequestOptions::parse($opts);
        $instance = new static($id, $opts);
        $instance->refresh();
        return $instance;
    }
    /**
     * Updates a <code>Location</code> object by setting the values of the parameters
     * passed. Any parameters not provided will be left unchanged.
     *
     * @param string $id the ID of the resource to update
     * @param null|array{address?: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, address_kana?: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string, town?: string}, address_kanji?: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string, town?: string}, configuration_overrides?: null|string, display_name?: null|string, display_name_kana?: null|string, display_name_kanji?: null|string, expand?: string[], metadata?: null|array<string, string>, phone?: null|string} $params
     * @param null|array|string $opts
     *
     * @return Location the updated resource
     *
     * @throws \InvizoSubscriptionsLiteVendor\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 = \InvizoSubscriptionsLiteVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
        $obj->setLastResponse($response);
        return $obj;
    }
}