// 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.ProxyResource;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** Definition of the watcher type. */
@Fluent
public final class WatcherInner extends ProxyResource {
    /*
     * Gets or sets the watcher properties.
     */
    @JsonProperty(value = "properties")
    private WatcherProperties innerProperties;

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

    /*
     * Resource tags.
     */
    @JsonProperty(value = "tags")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> tags;

    /*
     * The geo-location where the resource lives
     */
    @JsonProperty(value = "location")
    private String location;

    /**
     * Get the innerProperties property: Gets or sets the watcher properties.
     *
     * @return the innerProperties value.
     */
    private WatcherProperties 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 WatcherInner object itself.
     */
    public WatcherInner withEtag(String etag) {
        this.etag = etag;
        return this;
    }

    /**
     * Get the tags property: Resource tags.
     *
     * @return the tags value.
     */
    public Map<String, String> tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Resource tags.
     *
     * @param tags the tags value to set.
     * @return the WatcherInner object itself.
     */
    public WatcherInner withTags(Map<String, String> tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the location property: The geo-location where the resource lives.
     *
     * @return the location value.
     */
    public String location() {
        return this.location;
    }

    /**
     * Set the location property: The geo-location where the resource lives.
     *
     * @param location the location value to set.
     * @return the WatcherInner object itself.
     */
    public WatcherInner withLocation(String location) {
        this.location = location;
        return this;
    }

    /**
     * Get the executionFrequencyInSeconds property: Gets or sets the frequency at which the watcher is invoked.
     *
     * @return the executionFrequencyInSeconds value.
     */
    public Long executionFrequencyInSeconds() {
        return this.innerProperties() == null ? null : this.innerProperties().executionFrequencyInSeconds();
    }

    /**
     * Set the executionFrequencyInSeconds property: Gets or sets the frequency at which the watcher is invoked.
     *
     * @param executionFrequencyInSeconds the executionFrequencyInSeconds value to set.
     * @return the WatcherInner object itself.
     */
    public WatcherInner withExecutionFrequencyInSeconds(Long executionFrequencyInSeconds) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WatcherProperties();
        }
        this.innerProperties().withExecutionFrequencyInSeconds(executionFrequencyInSeconds);
        return this;
    }

    /**
     * Get the scriptName property: Gets or sets the name of the script the watcher is attached to, i.e. the name of an
     * existing runbook.
     *
     * @return the scriptName value.
     */
    public String scriptName() {
        return this.innerProperties() == null ? null : this.innerProperties().scriptName();
    }

    /**
     * Set the scriptName property: Gets or sets the name of the script the watcher is attached to, i.e. the name of an
     * existing runbook.
     *
     * @param scriptName the scriptName value to set.
     * @return the WatcherInner object itself.
     */
    public WatcherInner withScriptName(String scriptName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WatcherProperties();
        }
        this.innerProperties().withScriptName(scriptName);
        return this;
    }

    /**
     * Get the scriptParameters property: Gets or sets the parameters of the script.
     *
     * @return the scriptParameters value.
     */
    public Map<String, String> scriptParameters() {
        return this.innerProperties() == null ? null : this.innerProperties().scriptParameters();
    }

    /**
     * Set the scriptParameters property: Gets or sets the parameters of the script.
     *
     * @param scriptParameters the scriptParameters value to set.
     * @return the WatcherInner object itself.
     */
    public WatcherInner withScriptParameters(Map<String, String> scriptParameters) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WatcherProperties();
        }
        this.innerProperties().withScriptParameters(scriptParameters);
        return this;
    }

    /**
     * Get the scriptRunOn property: Gets or sets the name of the hybrid worker group the watcher will run on.
     *
     * @return the scriptRunOn value.
     */
    public String scriptRunOn() {
        return this.innerProperties() == null ? null : this.innerProperties().scriptRunOn();
    }

    /**
     * Set the scriptRunOn property: Gets or sets the name of the hybrid worker group the watcher will run on.
     *
     * @param scriptRunOn the scriptRunOn value to set.
     * @return the WatcherInner object itself.
     */
    public WatcherInner withScriptRunOn(String scriptRunOn) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WatcherProperties();
        }
        this.innerProperties().withScriptRunOn(scriptRunOn);
        return this;
    }

    /**
     * Get the status property: Gets the current status of the watcher.
     *
     * @return the status value.
     */
    public String status() {
        return this.innerProperties() == null ? null : this.innerProperties().status();
    }

    /**
     * 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();
    }

    /**
     * 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();
    }

    /**
     * Get the lastModifiedBy property: Details of the user who last modified the watcher.
     *
     * @return the lastModifiedBy value.
     */
    public String lastModifiedBy() {
        return this.innerProperties() == null ? null : this.innerProperties().lastModifiedBy();
    }

    /**
     * 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 WatcherInner object itself.
     */
    public WatcherInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WatcherProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

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