// 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.ContentLink;
import com.azure.resourcemanager.automation.models.RunbookParameter;
import com.azure.resourcemanager.automation.models.RunbookProvisioningState;
import com.azure.resourcemanager.automation.models.RunbookState;
import com.azure.resourcemanager.automation.models.RunbookTypeEnum;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

/** Definition of the runbook property type. */
@Fluent
public final class RunbookPropertiesInner {
    /*
     * Gets or sets the type of the runbook.
     */
    @JsonProperty(value = "runbookType")
    private RunbookTypeEnum runbookType;

    /*
     * Gets or sets the published runbook content link.
     */
    @JsonProperty(value = "publishContentLink")
    private ContentLink publishContentLink;

    /*
     * Gets or sets the state of the runbook.
     */
    @JsonProperty(value = "state")
    private RunbookState state;

    /*
     * Gets or sets verbose log option.
     */
    @JsonProperty(value = "logVerbose")
    private Boolean logVerbose;

    /*
     * Gets or sets progress log option.
     */
    @JsonProperty(value = "logProgress")
    private Boolean logProgress;

    /*
     * Gets or sets the option to log activity trace of the runbook.
     */
    @JsonProperty(value = "logActivityTrace")
    private Integer logActivityTrace;

    /*
     * Gets or sets the job count of the runbook.
     */
    @JsonProperty(value = "jobCount")
    private Integer jobCount;

    /*
     * Gets or sets the runbook parameters.
     */
    @JsonProperty(value = "parameters")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, RunbookParameter> parameters;

    /*
     * Gets or sets the runbook output types.
     */
    @JsonProperty(value = "outputTypes")
    private List<String> outputTypes;

    /*
     * Gets or sets the draft runbook properties.
     */
    @JsonProperty(value = "draft")
    private RunbookDraftInner draft;

    /*
     * Gets or sets the provisioning state of the runbook.
     */
    @JsonProperty(value = "provisioningState")
    private RunbookProvisioningState provisioningState;

    /*
     * Gets or sets the last modified by.
     */
    @JsonProperty(value = "lastModifiedBy")
    private String lastModifiedBy;

    /*
     * 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;

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

    /**
     * Get the runbookType property: Gets or sets the type of the runbook.
     *
     * @return the runbookType value.
     */
    public RunbookTypeEnum runbookType() {
        return this.runbookType;
    }

    /**
     * Set the runbookType property: Gets or sets the type of the runbook.
     *
     * @param runbookType the runbookType value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withRunbookType(RunbookTypeEnum runbookType) {
        this.runbookType = runbookType;
        return this;
    }

    /**
     * Get the publishContentLink property: Gets or sets the published runbook content link.
     *
     * @return the publishContentLink value.
     */
    public ContentLink publishContentLink() {
        return this.publishContentLink;
    }

    /**
     * Set the publishContentLink property: Gets or sets the published runbook content link.
     *
     * @param publishContentLink the publishContentLink value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withPublishContentLink(ContentLink publishContentLink) {
        this.publishContentLink = publishContentLink;
        return this;
    }

    /**
     * Get the state property: Gets or sets the state of the runbook.
     *
     * @return the state value.
     */
    public RunbookState state() {
        return this.state;
    }

    /**
     * Set the state property: Gets or sets the state of the runbook.
     *
     * @param state the state value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withState(RunbookState state) {
        this.state = state;
        return this;
    }

    /**
     * Get the logVerbose property: Gets or sets verbose log option.
     *
     * @return the logVerbose value.
     */
    public Boolean logVerbose() {
        return this.logVerbose;
    }

    /**
     * Set the logVerbose property: Gets or sets verbose log option.
     *
     * @param logVerbose the logVerbose value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withLogVerbose(Boolean logVerbose) {
        this.logVerbose = logVerbose;
        return this;
    }

    /**
     * Get the logProgress property: Gets or sets progress log option.
     *
     * @return the logProgress value.
     */
    public Boolean logProgress() {
        return this.logProgress;
    }

    /**
     * Set the logProgress property: Gets or sets progress log option.
     *
     * @param logProgress the logProgress value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withLogProgress(Boolean logProgress) {
        this.logProgress = logProgress;
        return this;
    }

    /**
     * Get the logActivityTrace property: Gets or sets the option to log activity trace of the runbook.
     *
     * @return the logActivityTrace value.
     */
    public Integer logActivityTrace() {
        return this.logActivityTrace;
    }

    /**
     * Set the logActivityTrace property: Gets or sets the option to log activity trace of the runbook.
     *
     * @param logActivityTrace the logActivityTrace value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withLogActivityTrace(Integer logActivityTrace) {
        this.logActivityTrace = logActivityTrace;
        return this;
    }

    /**
     * Get the jobCount property: Gets or sets the job count of the runbook.
     *
     * @return the jobCount value.
     */
    public Integer jobCount() {
        return this.jobCount;
    }

    /**
     * Set the jobCount property: Gets or sets the job count of the runbook.
     *
     * @param jobCount the jobCount value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withJobCount(Integer jobCount) {
        this.jobCount = jobCount;
        return this;
    }

    /**
     * Get the parameters property: Gets or sets the runbook parameters.
     *
     * @return the parameters value.
     */
    public Map<String, RunbookParameter> parameters() {
        return this.parameters;
    }

    /**
     * Set the parameters property: Gets or sets the runbook parameters.
     *
     * @param parameters the parameters value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withParameters(Map<String, RunbookParameter> parameters) {
        this.parameters = parameters;
        return this;
    }

    /**
     * Get the outputTypes property: Gets or sets the runbook output types.
     *
     * @return the outputTypes value.
     */
    public List<String> outputTypes() {
        return this.outputTypes;
    }

    /**
     * Set the outputTypes property: Gets or sets the runbook output types.
     *
     * @param outputTypes the outputTypes value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withOutputTypes(List<String> outputTypes) {
        this.outputTypes = outputTypes;
        return this;
    }

    /**
     * Get the draft property: Gets or sets the draft runbook properties.
     *
     * @return the draft value.
     */
    public RunbookDraftInner draft() {
        return this.draft;
    }

    /**
     * Set the draft property: Gets or sets the draft runbook properties.
     *
     * @param draft the draft value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withDraft(RunbookDraftInner draft) {
        this.draft = draft;
        return this;
    }

    /**
     * Get the provisioningState property: Gets or sets the provisioning state of the runbook.
     *
     * @return the provisioningState value.
     */
    public RunbookProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Set the provisioningState property: Gets or sets the provisioning state of the runbook.
     *
     * @param provisioningState the provisioningState value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withProvisioningState(RunbookProvisioningState provisioningState) {
        this.provisioningState = provisioningState;
        return this;
    }

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

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

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (publishContentLink() != null) {
            publishContentLink().validate();
        }
        if (parameters() != null) {
            parameters()
                .values()
                .forEach(
                    e -> {
                        if (e != null) {
                            e.validate();
                        }
                    });
        }
        if (draft() != null) {
            draft().validate();
        }
    }
}
