# https://developers.google.com/wallet/reference/rest/v1/DateTime

from pydantic import BaseModel


class DateTime(BaseModel):
    # I found this robust regex to validate these ISO8601 dates, but it does
    # not include the time part:
    # https://regexlib.com/REDetails.aspx?regexp_id=3344. After that, I lost
    # all appetite for regexes, let the API do the validation for us.
    date: str
    """
    An ISO 8601 extended format date/time. Offset may or may not be required
    (refer to the parent field's documentation). Time may be specified up to
    nanosecond precision. Offsets may be specified with seconds precision (even
    though offset seconds is not part of ISO 8601).

    For example:

    `1985-04-12T23:20:50.52Z` would be 20 minutes and 50.52 seconds after the
    23rd hour of April 12th, 1985 in UTC.

    `1985-04-12T19:20:50.52-04:00` would be 20 minutes and 50.52 seconds after
    the 19th hour of April 12th, 1985, 4 hours before UTC (same instant in time
    as the above example). If the date/time is intended for a physical location
    in New York, this would be the equivalent of Eastern Daylight Time (EDT).
    Remember that offset varies in regions that observe Daylight Saving Time
    (or Summer Time), depending on the time of the year.

    `1985-04-12T19:20:50.52` would be 20 minutes and 50.52 seconds after the
    19th hour of April 12th, 1985 with no offset information.

    Providing an offset makes this an absolute instant in time around the
    world. The date/time will be adjusted based on the user's time zone. For
    example, a time of `2018-06-19T18:30:00-04:00` will be 18:30:00 for a user
    in New York and 15:30:00 for a user in Los Angeles.

    Omitting the offset makes this a local date/time, representing several
    instants in time around the world. The date/time will always be in the
    user's current time zone. For example, a time of `2018-06-19T18:30:00` will
    be 18:30:00 for a user in New York and also 18:30:00 for a user in Los
    Angeles. This is useful when the same local date/time should apply to many
    physical locations across several time zones.
    """
