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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.resourcemanager.automation.models.ContentLink;
import com.azure.resourcemanager.automation.models.ModuleErrorInfo;
import com.azure.resourcemanager.automation.models.ModuleProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** Definition of the module type. */
@Fluent
public final class ModuleInner extends Resource {
    /*
     * Gets or sets the module properties.
     */
    @JsonProperty(value = "properties")
    private ModuleProperties innerProperties;

    /*
     * Gets or sets the etag of the resource.
     */
    @JsonProperty(value = "etag")
    private String etag;

    /**
     * Get the innerProperties property: Gets or sets the module properties.
     *
     * @return the innerProperties value.
     */
    private ModuleProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the etag property: Gets or sets the etag of the resource.
     *
     * @return the etag value.
     */
    public String etag() {
        return this.etag;
    }

    /**
     * Set the etag property: Gets or sets the etag of the resource.
     *
     * @param etag the etag value to set.
     * @return the ModuleInner object itself.
     */
    public ModuleInner withEtag(String etag) {
        this.etag = etag;
        return this;
    }

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

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

    /**
     * Get the isGlobal property: Gets or sets the isGlobal flag of the module.
     *
     * @return the isGlobal value.
     */
    public Boolean isGlobal() {
        return this.innerProperties() == null ? null : this.innerProperties().isGlobal();
    }

    /**
     * Set the isGlobal property: Gets or sets the isGlobal flag of the module.
     *
     * @param isGlobal the isGlobal value to set.
     * @return the ModuleInner object itself.
     */
    public ModuleInner withIsGlobal(Boolean isGlobal) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ModuleProperties();
        }
        this.innerProperties().withIsGlobal(isGlobal);
        return this;
    }

    /**
     * Get the version property: Gets or sets the version of the module.
     *
     * @return the version value.
     */
    public String version() {
        return this.innerProperties() == null ? null : this.innerProperties().version();
    }

    /**
     * Set the version property: Gets or sets the version of the module.
     *
     * @param version the version value to set.
     * @return the ModuleInner object itself.
     */
    public ModuleInner withVersion(String version) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ModuleProperties();
        }
        this.innerProperties().withVersion(version);
        return this;
    }

    /**
     * Get the sizeInBytes property: Gets or sets the size in bytes of the module.
     *
     * @return the sizeInBytes value.
     */
    public Long sizeInBytes() {
        return this.innerProperties() == null ? null : this.innerProperties().sizeInBytes();
    }

    /**
     * Set the sizeInBytes property: Gets or sets the size in bytes of the module.
     *
     * @param sizeInBytes the sizeInBytes value to set.
     * @return the ModuleInner object itself.
     */
    public ModuleInner withSizeInBytes(Long sizeInBytes) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ModuleProperties();
        }
        this.innerProperties().withSizeInBytes(sizeInBytes);
        return this;
    }

    /**
     * Get the activityCount property: Gets or sets the activity count of the module.
     *
     * @return the activityCount value.
     */
    public Integer activityCount() {
        return this.innerProperties() == null ? null : this.innerProperties().activityCount();
    }

    /**
     * Set the activityCount property: Gets or sets the activity count of the module.
     *
     * @param activityCount the activityCount value to set.
     * @return the ModuleInner object itself.
     */
    public ModuleInner withActivityCount(Integer activityCount) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ModuleProperties();
        }
        this.innerProperties().withActivityCount(activityCount);
        return this;
    }

    /**
     * Get the provisioningState property: Gets or sets the provisioning state of the module.
     *
     * @return the provisioningState value.
     */
    public ModuleProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Set the provisioningState property: Gets or sets the provisioning state of the module.
     *
     * @param provisioningState the provisioningState value to set.
     * @return the ModuleInner object itself.
     */
    public ModuleInner withProvisioningState(ModuleProvisioningState provisioningState) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ModuleProperties();
        }
        this.innerProperties().withProvisioningState(provisioningState);
        return this;
    }

    /**
     * Get the contentLink property: Gets or sets the contentLink of the module.
     *
     * @return the contentLink value.
     */
    public ContentLink contentLink() {
        return this.innerProperties() == null ? null : this.innerProperties().contentLink();
    }

    /**
     * Set the contentLink property: Gets or sets the contentLink of the module.
     *
     * @param contentLink the contentLink value to set.
     * @return the ModuleInner object itself.
     */
    public ModuleInner withContentLink(ContentLink contentLink) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ModuleProperties();
        }
        this.innerProperties().withContentLink(contentLink);
        return this;
    }

    /**
     * Get the error property: Gets or sets the error info of the module.
     *
     * @return the error value.
     */
    public ModuleErrorInfo error() {
        return this.innerProperties() == null ? null : this.innerProperties().error();
    }

    /**
     * Set the error property: Gets or sets the error info of the module.
     *
     * @param error the error value to set.
     * @return the ModuleInner object itself.
     */
    public ModuleInner withError(ModuleErrorInfo error) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ModuleProperties();
        }
        this.innerProperties().withError(error);
        return this;
    }

    /**
     * Get the creationTime property: Gets or sets the creation time.
     *
     * @return the creationTime value.
     */
    public OffsetDateTime creationTime() {
        return this.innerProperties() == null ? null : this.innerProperties().creationTime();
    }

    /**
     * Set the creationTime property: Gets or sets the creation time.
     *
     * @param creationTime the creationTime value to set.
     * @return the ModuleInner object itself.
     */
    public ModuleInner withCreationTime(OffsetDateTime creationTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ModuleProperties();
        }
        this.innerProperties().withCreationTime(creationTime);
        return this;
    }

    /**
     * Get the lastModifiedTime property: Gets or sets the last modified time.
     *
     * @return the lastModifiedTime value.
     */
    public OffsetDateTime lastModifiedTime() {
        return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTime();
    }

    /**
     * Set the lastModifiedTime property: Gets or sets the last modified time.
     *
     * @param lastModifiedTime the lastModifiedTime value to set.
     * @return the ModuleInner object itself.
     */
    public ModuleInner withLastModifiedTime(OffsetDateTime lastModifiedTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ModuleProperties();
        }
        this.innerProperties().withLastModifiedTime(lastModifiedTime);
        return this;
    }

    /**
     * Get the description property: Gets or sets the description.
     *
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: Gets or sets the description.
     *
     * @param description the description value to set.
     * @return the ModuleInner object itself.
     */
    public ModuleInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ModuleProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the isComposite property: Gets or sets type of module, if its composite or not.
     *
     * @return the isComposite value.
     */
    public Boolean isComposite() {
        return this.innerProperties() == null ? null : this.innerProperties().isComposite();
    }

    /**
     * Set the isComposite property: Gets or sets type of module, if its composite or not.
     *
     * @param isComposite the isComposite value to set.
     * @return the ModuleInner object itself.
     */
    public ModuleInner withIsComposite(Boolean isComposite) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ModuleProperties();
        }
        this.innerProperties().withIsComposite(isComposite);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }
}
