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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.resourcemanager.kusto.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Class representing a database script. */
@Fluent
public final class ScriptInner extends ProxyResource {
    /*
     * The database script.
     */
    @JsonProperty(value = "properties")
    private ScriptProperties innerProperties;

    /*
     * Metadata pertaining to creation and last modification of the resource.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

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

    /**
     * Get the innerProperties property: The database script.
     *
     * @return the innerProperties value.
     */
    private ScriptProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Metadata pertaining to creation and last modification of the resource.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the scriptUrl property: The url to the KQL script blob file. Must not be used together with scriptContent
     * property.
     *
     * @return the scriptUrl value.
     */
    public String scriptUrl() {
        return this.innerProperties() == null ? null : this.innerProperties().scriptUrl();
    }

    /**
     * Set the scriptUrl property: The url to the KQL script blob file. Must not be used together with scriptContent
     * property.
     *
     * @param scriptUrl the scriptUrl value to set.
     * @return the ScriptInner object itself.
     */
    public ScriptInner withScriptUrl(String scriptUrl) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScriptProperties();
        }
        this.innerProperties().withScriptUrl(scriptUrl);
        return this;
    }

    /**
     * Get the scriptUrlSasToken property: The SaS token that provide read access to the file which contain the script.
     * Must be provided when using scriptUrl property.
     *
     * @return the scriptUrlSasToken value.
     */
    public String scriptUrlSasToken() {
        return this.innerProperties() == null ? null : this.innerProperties().scriptUrlSasToken();
    }

    /**
     * Set the scriptUrlSasToken property: The SaS token that provide read access to the file which contain the script.
     * Must be provided when using scriptUrl property.
     *
     * @param scriptUrlSasToken the scriptUrlSasToken value to set.
     * @return the ScriptInner object itself.
     */
    public ScriptInner withScriptUrlSasToken(String scriptUrlSasToken) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScriptProperties();
        }
        this.innerProperties().withScriptUrlSasToken(scriptUrlSasToken);
        return this;
    }

    /**
     * Get the scriptContent property: The script content. This property should be used when the script is provide
     * inline and not through file in a SA. Must not be used together with scriptUrl and scriptUrlSasToken properties.
     *
     * @return the scriptContent value.
     */
    public String scriptContent() {
        return this.innerProperties() == null ? null : this.innerProperties().scriptContent();
    }

    /**
     * Set the scriptContent property: The script content. This property should be used when the script is provide
     * inline and not through file in a SA. Must not be used together with scriptUrl and scriptUrlSasToken properties.
     *
     * @param scriptContent the scriptContent value to set.
     * @return the ScriptInner object itself.
     */
    public ScriptInner withScriptContent(String scriptContent) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScriptProperties();
        }
        this.innerProperties().withScriptContent(scriptContent);
        return this;
    }

    /**
     * Get the forceUpdateTag property: A unique string. If changed the script will be applied again.
     *
     * @return the forceUpdateTag value.
     */
    public String forceUpdateTag() {
        return this.innerProperties() == null ? null : this.innerProperties().forceUpdateTag();
    }

    /**
     * Set the forceUpdateTag property: A unique string. If changed the script will be applied again.
     *
     * @param forceUpdateTag the forceUpdateTag value to set.
     * @return the ScriptInner object itself.
     */
    public ScriptInner withForceUpdateTag(String forceUpdateTag) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScriptProperties();
        }
        this.innerProperties().withForceUpdateTag(forceUpdateTag);
        return this;
    }

    /**
     * Get the continueOnErrors property: Flag that indicates whether to continue if one of the command fails.
     *
     * @return the continueOnErrors value.
     */
    public Boolean continueOnErrors() {
        return this.innerProperties() == null ? null : this.innerProperties().continueOnErrors();
    }

    /**
     * Set the continueOnErrors property: Flag that indicates whether to continue if one of the command fails.
     *
     * @param continueOnErrors the continueOnErrors value to set.
     * @return the ScriptInner object itself.
     */
    public ScriptInner withContinueOnErrors(Boolean continueOnErrors) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ScriptProperties();
        }
        this.innerProperties().withContinueOnErrors(continueOnErrors);
        return this;
    }

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

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