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

/** Software update configuration collection item properties. */
@Fluent
public final class SoftwareUpdateConfigurationCollectionItemProperties {
    /*
     * Update specific properties of the software update configuration.
     */
    @JsonProperty(value = "updateConfiguration")
    private UpdateConfiguration updateConfiguration;

    /*
     * Pre and Post Tasks defined
     */
    @JsonProperty(value = "tasks")
    private SoftwareUpdateConfigurationTasks tasks;

    /*
     * execution frequency of the schedule associated with the software update configuration
     */
    @JsonProperty(value = "frequency")
    private ScheduleFrequency frequency;

    /*
     * the start time of the update.
     */
    @JsonProperty(value = "startTime")
    private OffsetDateTime startTime;

    /*
     * Creation time of the software update configuration, which only appears in the response.
     */
    @JsonProperty(value = "creationTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime creationTime;

    /*
     * Last time software update configuration was modified, which only appears in the response.
     */
    @JsonProperty(value = "lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime lastModifiedTime;

    /*
     * Provisioning state for the software update configuration, which only appears in the response.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private String provisioningState;

    /*
     * ext run time of the update.
     */
    @JsonProperty(value = "nextRun")
    private OffsetDateTime nextRun;

    /**
     * Get the updateConfiguration property: Update specific properties of the software update configuration.
     *
     * @return the updateConfiguration value.
     */
    public UpdateConfiguration updateConfiguration() {
        return this.updateConfiguration;
    }

    /**
     * Set the updateConfiguration property: Update specific properties of the software update configuration.
     *
     * @param updateConfiguration the updateConfiguration value to set.
     * @return the SoftwareUpdateConfigurationCollectionItemProperties object itself.
     */
    public SoftwareUpdateConfigurationCollectionItemProperties withUpdateConfiguration(
        UpdateConfiguration updateConfiguration) {
        this.updateConfiguration = updateConfiguration;
        return this;
    }

    /**
     * Get the tasks property: Pre and Post Tasks defined.
     *
     * @return the tasks value.
     */
    public SoftwareUpdateConfigurationTasks tasks() {
        return this.tasks;
    }

    /**
     * Set the tasks property: Pre and Post Tasks defined.
     *
     * @param tasks the tasks value to set.
     * @return the SoftwareUpdateConfigurationCollectionItemProperties object itself.
     */
    public SoftwareUpdateConfigurationCollectionItemProperties withTasks(SoftwareUpdateConfigurationTasks tasks) {
        this.tasks = tasks;
        return this;
    }

    /**
     * Get the frequency property: execution frequency of the schedule associated with the software update
     * configuration.
     *
     * @return the frequency value.
     */
    public ScheduleFrequency frequency() {
        return this.frequency;
    }

    /**
     * Set the frequency property: execution frequency of the schedule associated with the software update
     * configuration.
     *
     * @param frequency the frequency value to set.
     * @return the SoftwareUpdateConfigurationCollectionItemProperties object itself.
     */
    public SoftwareUpdateConfigurationCollectionItemProperties withFrequency(ScheduleFrequency frequency) {
        this.frequency = frequency;
        return this;
    }

    /**
     * Get the startTime property: the start time of the update.
     *
     * @return the startTime value.
     */
    public OffsetDateTime startTime() {
        return this.startTime;
    }

    /**
     * Set the startTime property: the start time of the update.
     *
     * @param startTime the startTime value to set.
     * @return the SoftwareUpdateConfigurationCollectionItemProperties object itself.
     */
    public SoftwareUpdateConfigurationCollectionItemProperties withStartTime(OffsetDateTime startTime) {
        this.startTime = startTime;
        return this;
    }

    /**
     * Get the creationTime property: Creation time of the software update configuration, which only appears in the
     * response.
     *
     * @return the creationTime value.
     */
    public OffsetDateTime creationTime() {
        return this.creationTime;
    }

    /**
     * Get the lastModifiedTime property: Last time software update configuration was modified, which only appears in
     * the response.
     *
     * @return the lastModifiedTime value.
     */
    public OffsetDateTime lastModifiedTime() {
        return this.lastModifiedTime;
    }

    /**
     * Get the provisioningState property: Provisioning state for the software update configuration, which only appears
     * in the response.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the nextRun property: ext run time of the update.
     *
     * @return the nextRun value.
     */
    public OffsetDateTime nextRun() {
        return this.nextRun;
    }

    /**
     * Set the nextRun property: ext run time of the update.
     *
     * @param nextRun the nextRun value to set.
     * @return the SoftwareUpdateConfigurationCollectionItemProperties object itself.
     */
    public SoftwareUpdateConfigurationCollectionItemProperties withNextRun(OffsetDateTime nextRun) {
        this.nextRun = nextRun;
        return this;
    }

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