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

package com.azure.resourcemanager.azureadexternalidentities.models;

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

/** The information required to check the availability of the name for the tenant. */
@Fluent
public final class CheckNameAvailabilityRequestBody {
    /*
     * The domain name to check for availability.
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /*
     * Country code of Azure tenant (e.g. 'US'). Refer to
     * [aka.ms/B2CDataResidency](https://aka.ms/B2CDataResidency) to see valid
     * country codes and corresponding data residency locations. If you do not
     * see a country code in an valid data residency location, choose one from
     * the list.
     */
    @JsonProperty(value = "countryCode", required = true)
    private String countryCode;

    /**
     * Get the name property: The domain name to check for availability.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: The domain name to check for availability.
     *
     * @param name the name value to set.
     * @return the CheckNameAvailabilityRequestBody object itself.
     */
    public CheckNameAvailabilityRequestBody withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the countryCode property: Country code of Azure tenant (e.g. 'US'). Refer to
     * [aka.ms/B2CDataResidency](https://aka.ms/B2CDataResidency) to see valid country codes and corresponding data
     * residency locations. If you do not see a country code in an valid data residency location, choose one from the
     * list.
     *
     * @return the countryCode value.
     */
    public String countryCode() {
        return this.countryCode;
    }

    /**
     * Set the countryCode property: Country code of Azure tenant (e.g. 'US'). Refer to
     * [aka.ms/B2CDataResidency](https://aka.ms/B2CDataResidency) to see valid country codes and corresponding data
     * residency locations. If you do not see a country code in an valid data residency location, choose one from the
     * list.
     *
     * @param countryCode the countryCode value to set.
     * @return the CheckNameAvailabilityRequestBody object itself.
     */
    public CheckNameAvailabilityRequestBody withCountryCode(String countryCode) {
        this.countryCode = countryCode;
        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 CheckNameAvailabilityRequestBody"));
        }
        if (countryCode() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property countryCode in model CheckNameAvailabilityRequestBody"));
        }
    }

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