// 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.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/** Defines the properties of a health check step. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "stepType")
@JsonTypeName("HealthCheck")
@Fluent
public final class HealthCheckStepProperties extends StepProperties {
    /*
     * The health check step attributes
     */
    @JsonProperty(value = "attributes", required = true)
    private HealthCheckStepAttributes attributes;

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

    /**
     * Get the attributes property: The health check step attributes.
     *
     * @return the attributes value.
     */
    public HealthCheckStepAttributes attributes() {
        return this.attributes;
    }

    /**
     * Set the attributes property: The health check step attributes.
     *
     * @param attributes the attributes value to set.
     * @return the HealthCheckStepProperties object itself.
     */
    public HealthCheckStepProperties withAttributes(HealthCheckStepAttributes attributes) {
        this.attributes = attributes;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (attributes() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property attributes in model HealthCheckStepProperties"));
        } else {
            attributes().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(HealthCheckStepProperties.class);
}
