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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.devtestlabs.models.FormulaPropertiesFromVm;
import com.azure.resourcemanager.devtestlabs.models.LabVirtualMachineCreationParameter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** A formula for creating a VM, specifying an image base and other parameters. */
@Fluent
public final class FormulaInner extends Resource {
    /*
     * The properties of the resource.
     */
    @JsonProperty(value = "properties", required = true)
    private FormulaProperties innerProperties = new FormulaProperties();

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

    /**
     * Get the innerProperties property: The properties of the resource.
     *
     * @return the innerProperties value.
     */
    private FormulaProperties innerProperties() {
        return this.innerProperties;
    }

    /** {@inheritDoc} */
    @Override
    public FormulaInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public FormulaInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the description property: The description of the formula.
     *
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: The description of the formula.
     *
     * @param description the description value to set.
     * @return the FormulaInner object itself.
     */
    public FormulaInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new FormulaProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the author property: The author of the formula.
     *
     * @return the author value.
     */
    public String author() {
        return this.innerProperties() == null ? null : this.innerProperties().author();
    }

    /**
     * Get the osType property: The OS type of the formula.
     *
     * @return the osType value.
     */
    public String osType() {
        return this.innerProperties() == null ? null : this.innerProperties().osType();
    }

    /**
     * Set the osType property: The OS type of the formula.
     *
     * @param osType the osType value to set.
     * @return the FormulaInner object itself.
     */
    public FormulaInner withOsType(String osType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new FormulaProperties();
        }
        this.innerProperties().withOsType(osType);
        return this;
    }

    /**
     * Get the creationDate property: The creation date of the formula.
     *
     * @return the creationDate value.
     */
    public OffsetDateTime creationDate() {
        return this.innerProperties() == null ? null : this.innerProperties().creationDate();
    }

    /**
     * Get the formulaContent property: The content of the formula.
     *
     * @return the formulaContent value.
     */
    public LabVirtualMachineCreationParameter formulaContent() {
        return this.innerProperties() == null ? null : this.innerProperties().formulaContent();
    }

    /**
     * Set the formulaContent property: The content of the formula.
     *
     * @param formulaContent the formulaContent value to set.
     * @return the FormulaInner object itself.
     */
    public FormulaInner withFormulaContent(LabVirtualMachineCreationParameter formulaContent) {
        if (this.innerProperties() == null) {
            this.innerProperties = new FormulaProperties();
        }
        this.innerProperties().withFormulaContent(formulaContent);
        return this;
    }

    /**
     * Get the vm property: Information about a VM from which a formula is to be created.
     *
     * @return the vm value.
     */
    public FormulaPropertiesFromVm vm() {
        return this.innerProperties() == null ? null : this.innerProperties().vm();
    }

    /**
     * Set the vm property: Information about a VM from which a formula is to be created.
     *
     * @param vm the vm value to set.
     * @return the FormulaInner object itself.
     */
    public FormulaInner withVm(FormulaPropertiesFromVm vm) {
        if (this.innerProperties() == null) {
            this.innerProperties = new FormulaProperties();
        }
        this.innerProperties().withVm(vm);
        return this;
    }

    /**
     * Get the provisioningState property: The provisioning status of the resource.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid).
     *
     * @return the uniqueIdentifier value.
     */
    public String uniqueIdentifier() {
        return this.innerProperties() == null ? null : this.innerProperties().uniqueIdentifier();
    }

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

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