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

package com.azure.resourcemanager.logic.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** The batch configuration properties definition. */
@Fluent
public final class BatchConfigurationProperties extends ArtifactProperties {
    /*
     * The name of the batch group.
     */
    @JsonProperty(value = "batchGroupName", required = true)
    private String batchGroupName;

    /*
     * The batch release criteria.
     */
    @JsonProperty(value = "releaseCriteria", required = true)
    private BatchReleaseCriteria releaseCriteria;

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

    /**
     * Get the batchGroupName property: The name of the batch group.
     *
     * @return the batchGroupName value.
     */
    public String batchGroupName() {
        return this.batchGroupName;
    }

    /**
     * Set the batchGroupName property: The name of the batch group.
     *
     * @param batchGroupName the batchGroupName value to set.
     * @return the BatchConfigurationProperties object itself.
     */
    public BatchConfigurationProperties withBatchGroupName(String batchGroupName) {
        this.batchGroupName = batchGroupName;
        return this;
    }

    /**
     * Get the releaseCriteria property: The batch release criteria.
     *
     * @return the releaseCriteria value.
     */
    public BatchReleaseCriteria releaseCriteria() {
        return this.releaseCriteria;
    }

    /**
     * Set the releaseCriteria property: The batch release criteria.
     *
     * @param releaseCriteria the releaseCriteria value to set.
     * @return the BatchConfigurationProperties object itself.
     */
    public BatchConfigurationProperties withReleaseCriteria(BatchReleaseCriteria releaseCriteria) {
        this.releaseCriteria = releaseCriteria;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public BatchConfigurationProperties withCreatedTime(OffsetDateTime createdTime) {
        super.withCreatedTime(createdTime);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public BatchConfigurationProperties withChangedTime(OffsetDateTime changedTime) {
        super.withChangedTime(changedTime);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public BatchConfigurationProperties withMetadata(Object metadata) {
        super.withMetadata(metadata);
        return this;
    }

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

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