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

/** Definition of the webhook properties. */
@Fluent
public final class WebhookProperties {
    /*
     * Gets or sets the value of the enabled flag of the webhook.
     */
    @JsonProperty(value = "isEnabled")
    private Boolean isEnabled;

    /*
     * Gets or sets the webhook uri.
     */
    @JsonProperty(value = "uri")
    private String uri;

    /*
     * Gets or sets the expiry time.
     */
    @JsonProperty(value = "expiryTime")
    private OffsetDateTime expiryTime;

    /*
     * Gets or sets the last invoked time.
     */
    @JsonProperty(value = "lastInvokedTime")
    private OffsetDateTime lastInvokedTime;

    /*
     * Gets or sets the parameters of the job that is created when the webhook calls the runbook it is associated with.
     */
    @JsonProperty(value = "parameters")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> parameters;

    /*
     * Gets or sets the runbook the webhook is associated with.
     */
    @JsonProperty(value = "runbook")
    private RunbookAssociationProperty runbook;

    /*
     * Gets or sets the name of the hybrid worker group the webhook job will run on.
     */
    @JsonProperty(value = "runOn")
    private String runOn;

    /*
     * Gets or sets the creation time.
     */
    @JsonProperty(value = "creationTime")
    private OffsetDateTime creationTime;

    /*
     * Gets or sets the last modified time.
     */
    @JsonProperty(value = "lastModifiedTime")
    private OffsetDateTime lastModifiedTime;

    /*
     * Details of the user who last modified the Webhook
     */
    @JsonProperty(value = "lastModifiedBy")
    private String lastModifiedBy;

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

    /**
     * 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.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 WebhookProperties object itself.
     */
    public WebhookProperties withIsEnabled(Boolean isEnabled) {
        this.isEnabled = isEnabled;
        return this;
    }

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

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

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

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

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

    /**
     * Set the lastInvokedTime property: Gets or sets the last invoked time.
     *
     * @param lastInvokedTime the lastInvokedTime value to set.
     * @return the WebhookProperties object itself.
     */
    public WebhookProperties withLastInvokedTime(OffsetDateTime lastInvokedTime) {
        this.lastInvokedTime = 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.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 WebhookProperties object itself.
     */
    public WebhookProperties withParameters(Map<String, String> parameters) {
        this.parameters = 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.runbook;
    }

    /**
     * Set the runbook property: Gets or sets the runbook the webhook is associated with.
     *
     * @param runbook the runbook value to set.
     * @return the WebhookProperties object itself.
     */
    public WebhookProperties withRunbook(RunbookAssociationProperty runbook) {
        this.runbook = 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.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 WebhookProperties object itself.
     */
    public WebhookProperties withRunOn(String runOn) {
        this.runOn = runOn;
        return this;
    }

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

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

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

    /**
     * Set the lastModifiedTime property: Gets or sets the last modified time.
     *
     * @param lastModifiedTime the lastModifiedTime value to set.
     * @return the WebhookProperties object itself.
     */
    public WebhookProperties withLastModifiedTime(OffsetDateTime lastModifiedTime) {
        this.lastModifiedTime = 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.lastModifiedBy;
    }

    /**
     * Set the lastModifiedBy property: Details of the user who last modified the Webhook.
     *
     * @param lastModifiedBy the lastModifiedBy value to set.
     * @return the WebhookProperties object itself.
     */
    public WebhookProperties withLastModifiedBy(String lastModifiedBy) {
        this.lastModifiedBy = lastModifiedBy;
        return this;
    }

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

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

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