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

package com.azure.resourcemanager.notificationhubs.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Parameters supplied to the Check Name Availability for Namespace and NotificationHubs. */
@Fluent
public final class CheckAvailabilityParameters {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckAvailabilityParameters.class);

    /*
     * Resource Id
     */
    @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
    private String id;

    /*
     * Resource name
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /*
     * Resource type
     */
    @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
    private String type;

    /*
     * Resource location
     */
    @JsonProperty(value = "location")
    private String location;

    /*
     * Resource tags
     */
    @JsonProperty(value = "tags")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> tags;

    /*
     * The sku of the created namespace
     */
    @JsonProperty(value = "sku")
    private Sku sku;

    /*
     * True if the name is available and can be used to create new
     * Namespace/NotificationHub. Otherwise false.
     */
    @JsonProperty(value = "isAvailiable")
    private Boolean isAvailiable;

    /**
     * Get the id property: Resource Id.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

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

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

    /**
     * Get the type property: Resource type.
     *
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Get the location property: Resource location.
     *
     * @return the location value.
     */
    public String location() {
        return this.location;
    }

    /**
     * Set the location property: Resource location.
     *
     * @param location the location value to set.
     * @return the CheckAvailabilityParameters object itself.
     */
    public CheckAvailabilityParameters withLocation(String location) {
        this.location = location;
        return this;
    }

    /**
     * Get the tags property: Resource tags.
     *
     * @return the tags value.
     */
    public Map<String, String> tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Resource tags.
     *
     * @param tags the tags value to set.
     * @return the CheckAvailabilityParameters object itself.
     */
    public CheckAvailabilityParameters withTags(Map<String, String> tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the sku property: The sku of the created namespace.
     *
     * @return the sku value.
     */
    public Sku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: The sku of the created namespace.
     *
     * @param sku the sku value to set.
     * @return the CheckAvailabilityParameters object itself.
     */
    public CheckAvailabilityParameters withSku(Sku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the isAvailiable property: True if the name is available and can be used to create new
     * Namespace/NotificationHub. Otherwise false.
     *
     * @return the isAvailiable value.
     */
    public Boolean isAvailiable() {
        return this.isAvailiable;
    }

    /**
     * Set the isAvailiable property: True if the name is available and can be used to create new
     * Namespace/NotificationHub. Otherwise false.
     *
     * @param isAvailiable the isAvailiable value to set.
     * @return the CheckAvailabilityParameters object itself.
     */
    public CheckAvailabilityParameters withIsAvailiable(Boolean isAvailiable) {
        this.isAvailiable = isAvailiable;
        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 CheckAvailabilityParameters"));
        }
        if (sku() != null) {
            sku().validate();
        }
    }
}
