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

/** The RunbookDraft model. */
@Fluent
public final class RunbookDraftInner {
    /*
     * Gets or sets whether runbook is in edit mode.
     */
    @JsonProperty(value = "inEdit")
    private Boolean inEdit;

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

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

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

    /*
     * Gets or sets the runbook draft 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;

    /**
     * Get the inEdit property: Gets or sets whether runbook is in edit mode.
     *
     * @return the inEdit value.
     */
    public Boolean inEdit() {
        return this.inEdit;
    }

    /**
     * Set the inEdit property: Gets or sets whether runbook is in edit mode.
     *
     * @param inEdit the inEdit value to set.
     * @return the RunbookDraftInner object itself.
     */
    public RunbookDraftInner withInEdit(Boolean inEdit) {
        this.inEdit = inEdit;
        return this;
    }

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

    /**
     * Set the draftContentLink property: Gets or sets the draft runbook content link.
     *
     * @param draftContentLink the draftContentLink value to set.
     * @return the RunbookDraftInner object itself.
     */
    public RunbookDraftInner withDraftContentLink(ContentLink draftContentLink) {
        this.draftContentLink = draftContentLink;
        return this;
    }

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

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

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

    /**
     * Set the lastModifiedTime property: Gets or sets the last modified time of the runbook draft.
     *
     * @param lastModifiedTime the lastModifiedTime value to set.
     * @return the RunbookDraftInner object itself.
     */
    public RunbookDraftInner withLastModifiedTime(OffsetDateTime lastModifiedTime) {
        this.lastModifiedTime = lastModifiedTime;
        return this;
    }

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

    /**
     * Set the parameters property: Gets or sets the runbook draft parameters.
     *
     * @param parameters the parameters value to set.
     * @return the RunbookDraftInner object itself.
     */
    public RunbookDraftInner 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 RunbookDraftInner object itself.
     */
    public RunbookDraftInner withOutputTypes(List<String> outputTypes) {
        this.outputTypes = outputTypes;
        return this;
    }

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