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

package com.azure.resourcemanager.imagebuilder.models;

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

/** Describes the target region information. */
@Fluent
public final class TargetRegion {
    /*
     * The name of the region.
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /*
     * The number of replicas of the Image Version to be created in this region. Omit to use the default (1).
     */
    @JsonProperty(value = "replicaCount")
    private Integer replicaCount;

    /*
     * Specifies the storage account type to be used to store the image in this region. Omit to use the default
     * (Standard_LRS).
     */
    @JsonProperty(value = "storageAccountType")
    private SharedImageStorageAccountType storageAccountType;

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

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

    /**
     * Set the name property: The name of the region.
     *
     * @param name the name value to set.
     * @return the TargetRegion object itself.
     */
    public TargetRegion withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the replicaCount property: The number of replicas of the Image Version to be created in this region. Omit to
     * use the default (1).
     *
     * @return the replicaCount value.
     */
    public Integer replicaCount() {
        return this.replicaCount;
    }

    /**
     * Set the replicaCount property: The number of replicas of the Image Version to be created in this region. Omit to
     * use the default (1).
     *
     * @param replicaCount the replicaCount value to set.
     * @return the TargetRegion object itself.
     */
    public TargetRegion withReplicaCount(Integer replicaCount) {
        this.replicaCount = replicaCount;
        return this;
    }

    /**
     * Get the storageAccountType property: Specifies the storage account type to be used to store the image in this
     * region. Omit to use the default (Standard_LRS).
     *
     * @return the storageAccountType value.
     */
    public SharedImageStorageAccountType storageAccountType() {
        return this.storageAccountType;
    }

    /**
     * Set the storageAccountType property: Specifies the storage account type to be used to store the image in this
     * region. Omit to use the default (Standard_LRS).
     *
     * @param storageAccountType the storageAccountType value to set.
     * @return the TargetRegion object itself.
     */
    public TargetRegion withStorageAccountType(SharedImageStorageAccountType storageAccountType) {
        this.storageAccountType = storageAccountType;
        return this;
    }

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

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