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

package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationNameAvailabilityReason;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Represents a migration name's availability. */
@Fluent
public final class MigrationNameAvailabilityResourceInner {
    /*
     * The resource name to verify.
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /*
     * The type of the resource.
     */
    @JsonProperty(value = "type", required = true)
    private String type;

    /*
     * Indicates whether the resource name is available.
     */
    @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY)
    private Boolean nameAvailable;

    /*
     * Migration name availability reason
     */
    @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY)
    private MigrationNameAvailabilityReason reason;

    /*
     * Migration name availability message.
     */
    @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY)
    private String message;

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

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

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

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

    /**
     * Set the type property: The type of the resource.
     *
     * @param type the type value to set.
     * @return the MigrationNameAvailabilityResourceInner object itself.
     */
    public MigrationNameAvailabilityResourceInner withType(String type) {
        this.type = type;
        return this;
    }

    /**
     * Get the nameAvailable property: Indicates whether the resource name is available.
     *
     * @return the nameAvailable value.
     */
    public Boolean nameAvailable() {
        return this.nameAvailable;
    }

    /**
     * Get the reason property: Migration name availability reason.
     *
     * @return the reason value.
     */
    public MigrationNameAvailabilityReason reason() {
        return this.reason;
    }

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

    /**
     * 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 MigrationNameAvailabilityResourceInner"));
        }
        if (type() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property type in model MigrationNameAvailabilityResourceInner"));
        }
    }

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