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

package com.azure.resourcemanager.recoveryservicesbackup.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

/** Recovery point specific to PointInTime. */
@JsonTypeInfo(
    use = JsonTypeInfo.Id.NAME,
    include = JsonTypeInfo.As.PROPERTY,
    property = "objectType",
    defaultImpl = AzureWorkloadPointInTimeRecoveryPoint.class)
@JsonTypeName("AzureWorkloadPointInTimeRecoveryPoint")
@JsonSubTypes({
    @JsonSubTypes.Type(
        name = "AzureWorkloadSAPHanaPointInTimeRecoveryPoint",
        value = AzureWorkloadSapHanaPointInTimeRecoveryPoint.class)
})
@Fluent
public class AzureWorkloadPointInTimeRecoveryPoint extends AzureWorkloadRecoveryPoint {
    /*
     * List of log ranges
     */
    @JsonProperty(value = "timeRanges")
    private List<PointInTimeRange> timeRanges;

    /** Creates an instance of AzureWorkloadPointInTimeRecoveryPoint class. */
    public AzureWorkloadPointInTimeRecoveryPoint() {
    }

    /**
     * Get the timeRanges property: List of log ranges.
     *
     * @return the timeRanges value.
     */
    public List<PointInTimeRange> timeRanges() {
        return this.timeRanges;
    }

    /**
     * Set the timeRanges property: List of log ranges.
     *
     * @param timeRanges the timeRanges value to set.
     * @return the AzureWorkloadPointInTimeRecoveryPoint object itself.
     */
    public AzureWorkloadPointInTimeRecoveryPoint withTimeRanges(List<PointInTimeRange> timeRanges) {
        this.timeRanges = timeRanges;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AzureWorkloadPointInTimeRecoveryPoint withRecoveryPointTimeInUtc(OffsetDateTime recoveryPointTimeInUtc) {
        super.withRecoveryPointTimeInUtc(recoveryPointTimeInUtc);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AzureWorkloadPointInTimeRecoveryPoint withType(RestorePointType type) {
        super.withType(type);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AzureWorkloadPointInTimeRecoveryPoint withRecoveryPointTierDetails(
        List<RecoveryPointTierInformationV2> recoveryPointTierDetails) {
        super.withRecoveryPointTierDetails(recoveryPointTierDetails);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AzureWorkloadPointInTimeRecoveryPoint withRecoveryPointMoveReadinessInfo(
        Map<String, RecoveryPointMoveReadinessInfo> recoveryPointMoveReadinessInfo) {
        super.withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AzureWorkloadPointInTimeRecoveryPoint withRecoveryPointProperties(
        RecoveryPointProperties recoveryPointProperties) {
        super.withRecoveryPointProperties(recoveryPointProperties);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (timeRanges() != null) {
            timeRanges().forEach(e -> e.validate());
        }
    }
}
