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

package com.azure.resourcemanager.deploymentmanager.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.deploymentmanager.fluent.models.RestParameters;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.List;

/** Defines the REST health check step properties. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonTypeName("REST")
@Fluent
public final class RestHealthCheckStepAttributes extends HealthCheckStepAttributes {
    /*
     * The REST health check parameters.
     */
    @JsonProperty(value = "properties")
    private RestParameters innerProperties;

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

    /**
     * Get the innerProperties property: The REST health check parameters.
     *
     * @return the innerProperties value.
     */
    private RestParameters innerProperties() {
        return this.innerProperties;
    }

    /** {@inheritDoc} */
    @Override
    public RestHealthCheckStepAttributes withWaitDuration(String waitDuration) {
        super.withWaitDuration(waitDuration);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public RestHealthCheckStepAttributes withMaxElasticDuration(String maxElasticDuration) {
        super.withMaxElasticDuration(maxElasticDuration);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public RestHealthCheckStepAttributes withHealthyStateDuration(String healthyStateDuration) {
        super.withHealthyStateDuration(healthyStateDuration);
        return this;
    }

    /**
     * Get the healthChecks property: The list of checks that form the health check step.
     *
     * @return the healthChecks value.
     */
    public List<RestHealthCheck> healthChecks() {
        return this.innerProperties() == null ? null : this.innerProperties().healthChecks();
    }

    /**
     * Set the healthChecks property: The list of checks that form the health check step.
     *
     * @param healthChecks the healthChecks value to set.
     * @return the RestHealthCheckStepAttributes object itself.
     */
    public RestHealthCheckStepAttributes withHealthChecks(List<RestHealthCheck> healthChecks) {
        if (this.innerProperties() == null) {
            this.innerProperties = new RestParameters();
        }
        this.innerProperties().withHealthChecks(healthChecks);
        return this;
    }

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