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

package com.azure.resourcemanager.appservice.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.appservice.fluent.models.ValidateProperties;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Resource validation request content. */
@Fluent
public final class ValidateRequest {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(ValidateRequest.class);

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

    /*
     * Resource type used for verification.
     */
    @JsonProperty(value = "type", required = true)
    private ValidateResourceTypes type;

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

    /*
     * Properties of the resource to validate.
     */
    @JsonProperty(value = "properties", required = true)
    private ValidateProperties innerProperties = new ValidateProperties();

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

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

    /**
     * Get the type property: Resource type used for verification.
     *
     * @return the type value.
     */
    public ValidateResourceTypes type() {
        return this.type;
    }

    /**
     * Set the type property: Resource type used for verification.
     *
     * @param type the type value to set.
     * @return the ValidateRequest object itself.
     */
    public ValidateRequest withType(ValidateResourceTypes type) {
        this.type = type;
        return this;
    }

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

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

    /**
     * Get the innerProperties property: Properties of the resource to validate.
     *
     * @return the innerProperties value.
     */
    private ValidateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the serverFarmId property: ARM resource ID of an App Service plan that would host the app.
     *
     * @return the serverFarmId value.
     */
    public String serverFarmId() {
        return this.innerProperties() == null ? null : this.innerProperties().serverFarmId();
    }

    /**
     * Set the serverFarmId property: ARM resource ID of an App Service plan that would host the app.
     *
     * @param serverFarmId the serverFarmId value to set.
     * @return the ValidateRequest object itself.
     */
    public ValidateRequest withServerFarmId(String serverFarmId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ValidateProperties();
        }
        this.innerProperties().withServerFarmId(serverFarmId);
        return this;
    }

    /**
     * Get the skuName property: Name of the target SKU for the App Service plan.
     *
     * @return the skuName value.
     */
    public String skuName() {
        return this.innerProperties() == null ? null : this.innerProperties().skuName();
    }

    /**
     * Set the skuName property: Name of the target SKU for the App Service plan.
     *
     * @param skuName the skuName value to set.
     * @return the ValidateRequest object itself.
     */
    public ValidateRequest withSkuName(String skuName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ValidateProperties();
        }
        this.innerProperties().withSkuName(skuName);
        return this;
    }

    /**
     * Get the needLinuxWorkers property: &lt;code&gt;true&lt;/code&gt; if App Service plan is for Linux workers;
     * otherwise, &lt;code&gt;false&lt;/code&gt;.
     *
     * @return the needLinuxWorkers value.
     */
    public Boolean needLinuxWorkers() {
        return this.innerProperties() == null ? null : this.innerProperties().needLinuxWorkers();
    }

    /**
     * Set the needLinuxWorkers property: &lt;code&gt;true&lt;/code&gt; if App Service plan is for Linux workers;
     * otherwise, &lt;code&gt;false&lt;/code&gt;.
     *
     * @param needLinuxWorkers the needLinuxWorkers value to set.
     * @return the ValidateRequest object itself.
     */
    public ValidateRequest withNeedLinuxWorkers(Boolean needLinuxWorkers) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ValidateProperties();
        }
        this.innerProperties().withNeedLinuxWorkers(needLinuxWorkers);
        return this;
    }

    /**
     * Get the isSpot property: &lt;code&gt;true&lt;/code&gt; if App Service plan is for Spot instances; otherwise,
     * &lt;code&gt;false&lt;/code&gt;.
     *
     * @return the isSpot value.
     */
    public Boolean isSpot() {
        return this.innerProperties() == null ? null : this.innerProperties().isSpot();
    }

    /**
     * Set the isSpot property: &lt;code&gt;true&lt;/code&gt; if App Service plan is for Spot instances; otherwise,
     * &lt;code&gt;false&lt;/code&gt;.
     *
     * @param isSpot the isSpot value to set.
     * @return the ValidateRequest object itself.
     */
    public ValidateRequest withIsSpot(Boolean isSpot) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ValidateProperties();
        }
        this.innerProperties().withIsSpot(isSpot);
        return this;
    }

    /**
     * Get the capacity property: Target capacity of the App Service plan (number of VMs).
     *
     * @return the capacity value.
     */
    public Integer capacity() {
        return this.innerProperties() == null ? null : this.innerProperties().capacity();
    }

    /**
     * Set the capacity property: Target capacity of the App Service plan (number of VMs).
     *
     * @param capacity the capacity value to set.
     * @return the ValidateRequest object itself.
     */
    public ValidateRequest withCapacity(Integer capacity) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ValidateProperties();
        }
        this.innerProperties().withCapacity(capacity);
        return this;
    }

    /**
     * Get the hostingEnvironment property: Name of App Service Environment where app or App Service plan should be
     * created.
     *
     * @return the hostingEnvironment value.
     */
    public String hostingEnvironment() {
        return this.innerProperties() == null ? null : this.innerProperties().hostingEnvironment();
    }

    /**
     * Set the hostingEnvironment property: Name of App Service Environment where app or App Service plan should be
     * created.
     *
     * @param hostingEnvironment the hostingEnvironment value to set.
     * @return the ValidateRequest object itself.
     */
    public ValidateRequest withHostingEnvironment(String hostingEnvironment) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ValidateProperties();
        }
        this.innerProperties().withHostingEnvironment(hostingEnvironment);
        return this;
    }

    /**
     * Get the isXenon property: &lt;code&gt;true&lt;/code&gt; if App Service plan is running as a windows container.
     *
     * @return the isXenon value.
     */
    public Boolean isXenon() {
        return this.innerProperties() == null ? null : this.innerProperties().isXenon();
    }

    /**
     * Set the isXenon property: &lt;code&gt;true&lt;/code&gt; if App Service plan is running as a windows container.
     *
     * @param isXenon the isXenon value to set.
     * @return the ValidateRequest object itself.
     */
    public ValidateRequest withIsXenon(Boolean isXenon) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ValidateProperties();
        }
        this.innerProperties().withIsXenon(isXenon);
        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 ValidateRequest"));
        }
        if (type() == null) {
            throw logger
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property type in model ValidateRequest"));
        }
        if (location() == null) {
            throw logger
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property location in model ValidateRequest"));
        }
        if (innerProperties() == null) {
            throw logger
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property innerProperties in model ValidateRequest"));
        } else {
            innerProperties().validate();
        }
    }
}
