// 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;

/** SQL specific recoverypoint, specifically encapsulates full/diff recoverypoint along with extended info. */
@JsonTypeInfo(
    use = JsonTypeInfo.Id.NAME,
    include = JsonTypeInfo.As.PROPERTY,
    property = "objectType",
    defaultImpl = AzureWorkloadSqlRecoveryPoint.class)
@JsonTypeName("AzureWorkloadSQLRecoveryPoint")
@JsonSubTypes({
    @JsonSubTypes.Type(
        name = "AzureWorkloadSQLPointInTimeRecoveryPoint",
        value = AzureWorkloadSqlPointInTimeRecoveryPoint.class)
})
@Fluent
public class AzureWorkloadSqlRecoveryPoint extends AzureWorkloadRecoveryPoint {
    /*
     * Extended Info that provides data directory details. Will be populated in two cases:
     * When a specific recovery point is accessed using GetRecoveryPoint
     * Or when ListRecoveryPoints is called for Log RP only with ExtendedInfo query filter
     */
    @JsonProperty(value = "extendedInfo")
    private AzureWorkloadSqlRecoveryPointExtendedInfo extendedInfo;

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

    /**
     * Get the extendedInfo property: Extended Info that provides data directory details. Will be populated in two
     * cases: When a specific recovery point is accessed using GetRecoveryPoint Or when ListRecoveryPoints is called for
     * Log RP only with ExtendedInfo query filter.
     *
     * @return the extendedInfo value.
     */
    public AzureWorkloadSqlRecoveryPointExtendedInfo extendedInfo() {
        return this.extendedInfo;
    }

    /**
     * Set the extendedInfo property: Extended Info that provides data directory details. Will be populated in two
     * cases: When a specific recovery point is accessed using GetRecoveryPoint Or when ListRecoveryPoints is called for
     * Log RP only with ExtendedInfo query filter.
     *
     * @param extendedInfo the extendedInfo value to set.
     * @return the AzureWorkloadSqlRecoveryPoint object itself.
     */
    public AzureWorkloadSqlRecoveryPoint withExtendedInfo(AzureWorkloadSqlRecoveryPointExtendedInfo extendedInfo) {
        this.extendedInfo = extendedInfo;
        return this;
    }

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

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

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

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

    /** {@inheritDoc} */
    @Override
    public AzureWorkloadSqlRecoveryPoint 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 (extendedInfo() != null) {
            extendedInfo().validate();
        }
    }
}
