// 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.azure.resourcemanager.automation.models.RunbookAssociationProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

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

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

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

    /**
     * Set the isEnabled property: Gets or sets the value of the enabled flag of the webhook.
     *
     * @param isEnabled the isEnabled value to set.
     * @return the WebhookInner object itself.
     */
    public WebhookInner withIsEnabled(Boolean isEnabled) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WebhookProperties();
        }
        this.innerProperties().withIsEnabled(isEnabled);
        return this;
    }

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

    /**
     * Set the uri property: Gets or sets the webhook uri.
     *
     * @param uri the uri value to set.
     * @return the WebhookInner object itself.
     */
    public WebhookInner withUri(String uri) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WebhookProperties();
        }
        this.innerProperties().withUri(uri);
        return this;
    }

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

    /**
     * Set the expiryTime property: Gets or sets the expiry time.
     *
     * @param expiryTime the expiryTime value to set.
     * @return the WebhookInner object itself.
     */
    public WebhookInner withExpiryTime(OffsetDateTime expiryTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WebhookProperties();
        }
        this.innerProperties().withExpiryTime(expiryTime);
        return this;
    }

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

    /**
     * Set the lastInvokedTime property: Gets or sets the last invoked time.
     *
     * @param lastInvokedTime the lastInvokedTime value to set.
     * @return the WebhookInner object itself.
     */
    public WebhookInner withLastInvokedTime(OffsetDateTime lastInvokedTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WebhookProperties();
        }
        this.innerProperties().withLastInvokedTime(lastInvokedTime);
        return this;
    }

    /**
     * Get the parameters property: Gets or sets the parameters of the job that is created when the webhook calls the
     * runbook it is associated with.
     *
     * @return the parameters value.
     */
    public Map<String, String> parameters() {
        return this.innerProperties() == null ? null : this.innerProperties().parameters();
    }

    /**
     * Set the parameters property: Gets or sets the parameters of the job that is created when the webhook calls the
     * runbook it is associated with.
     *
     * @param parameters the parameters value to set.
     * @return the WebhookInner object itself.
     */
    public WebhookInner withParameters(Map<String, String> parameters) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WebhookProperties();
        }
        this.innerProperties().withParameters(parameters);
        return this;
    }

    /**
     * Get the runbook property: Gets or sets the runbook the webhook is associated with.
     *
     * @return the runbook value.
     */
    public RunbookAssociationProperty runbook() {
        return this.innerProperties() == null ? null : this.innerProperties().runbook();
    }

    /**
     * Set the runbook property: Gets or sets the runbook the webhook is associated with.
     *
     * @param runbook the runbook value to set.
     * @return the WebhookInner object itself.
     */
    public WebhookInner withRunbook(RunbookAssociationProperty runbook) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WebhookProperties();
        }
        this.innerProperties().withRunbook(runbook);
        return this;
    }

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

    /**
     * Set the runOn property: Gets or sets the name of the hybrid worker group the webhook job will run on.
     *
     * @param runOn the runOn value to set.
     * @return the WebhookInner object itself.
     */
    public WebhookInner withRunOn(String runOn) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WebhookProperties();
        }
        this.innerProperties().withRunOn(runOn);
        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 WebhookInner object itself.
     */
    public WebhookInner withCreationTime(OffsetDateTime creationTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WebhookProperties();
        }
        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 WebhookInner object itself.
     */
    public WebhookInner withLastModifiedTime(OffsetDateTime lastModifiedTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WebhookProperties();
        }
        this.innerProperties().withLastModifiedTime(lastModifiedTime);
        return this;
    }

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

    /**
     * Set the lastModifiedBy property: Details of the user who last modified the Webhook.
     *
     * @param lastModifiedBy the lastModifiedBy value to set.
     * @return the WebhookInner object itself.
     */
    public WebhookInner withLastModifiedBy(String lastModifiedBy) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WebhookProperties();
        }
        this.innerProperties().withLastModifiedBy(lastModifiedBy);
        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 WebhookInner object itself.
     */
    public WebhookInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WebhookProperties();
        }
        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();
        }
    }
}
