// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.maps.timezone.models;

import com.azure.core.annotation.Immutable;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;

/** The TimeTransition model. */
@Immutable
public final class TimeTransition {
    /*
     * Tag property
     */
    @JsonProperty(value = "Tag", access = JsonProperty.Access.WRITE_ONLY)
    private String tag;

    /*
     * StandardOffset property
     */
    @JsonProperty(value = "StandardOffset", access = JsonProperty.Access.WRITE_ONLY)
    private String standardOffset;

    /*
     * DaylightSavings property
     */
    @JsonProperty(value = "DaylightSavings", access = JsonProperty.Access.WRITE_ONLY)
    private String daylightSavings;

    /*
     * Start date, start time for this transition period
     */
    @JsonProperty(value = "UtcStart", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime utcStart;

    /*
     * End date, end time for this transition period
     */
    @JsonProperty(value = "UtcEnd", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime utcEnd;

    /** Set default TimeTransition constructor to private */
    private TimeTransition() {}

    /**
     * Get the tag property: Tag property.
     *
     * @return the tag value.
     */
    public String getTag() {
        return this.tag;
    }

    /**
     * TimeTransition constructor
     *
     * @param daylightSavings daylightSavings Time saving in minutes in effect at the `ReferenceUTCTimestamp`.
     * @param standardOffset UTC offset in effect at the `ReferenceUTCTimestamp`.
     */
    private TimeTransition(ZoneOffset daylightSavings, ZoneOffset standardOffset) {
        this.daylightSavings = daylightSavings.toString();
        this.standardOffset = standardOffset.toString();
    }

    /**
     * Get the utcStart property: Start date, start time for this transition period.
     *
     * @return the utcStart value.
     */
    public OffsetDateTime getUtcStart() {
        return this.utcStart;
    }

    /**
     * Get the utcEnd property: End date, end time for this transition period.
     *
     * @return the utcEnd value.
     */
    public OffsetDateTime getUtcEnd() {
        return this.utcEnd;
    }

    /**
     * return the standardOffset value
     *
     * @return Returns a {@link ZoneOffset} time offset.
     */
    public ZoneOffset getStandardOffset() {
        if (standardOffset.charAt(0) != '+' && standardOffset.charAt(0) != '-') {
            standardOffset = "+" + standardOffset;
        }
        return ZoneOffset.of(standardOffset);
    }

    /**
     * return the daylight savings value
     *
     * @return Returns a {@link ZoneOffset} daylight savings. Get the daylightSavings property: Time saving in minutes
     *     in effect at the `ReferenceUTCTimestamp.
     */
    public ZoneOffset getDaylightSavings() {
        if (daylightSavings.charAt(0) != '+' && daylightSavings.charAt(0) != '-') {
            daylightSavings = "+" + daylightSavings;
        }
        return ZoneOffset.of(daylightSavings);
    }
}
