// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.desktopvirtualization.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** The session host configuration for updating agent, monitoring agent, and stack component. */
@Fluent
public final class AgentUpdateProperties {
    /*
     * The type of maintenance for session host components.
     */
    @JsonProperty(value = "type")
    private SessionHostComponentUpdateType type;

    /*
     * Whether to use localTime of the virtual machine.
     */
    @JsonProperty(value = "useSessionHostLocalTime")
    private Boolean useSessionHostLocalTime;

    /*
     * Time zone for maintenance as defined in
     * https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.findsystemtimezonebyid?view=net-5.0. Must be set
     * if useLocalTime is true.
     */
    @JsonProperty(value = "maintenanceWindowTimeZone")
    private String maintenanceWindowTimeZone;

    /*
     * List of maintenance windows. Maintenance windows are 2 hours long.
     */
    @JsonProperty(value = "maintenanceWindows")
    private List<MaintenanceWindowProperties> maintenanceWindows;

    /** Creates an instance of AgentUpdateProperties class. */
    public AgentUpdateProperties() {
    }

    /**
     * Get the type property: The type of maintenance for session host components.
     *
     * @return the type value.
     */
    public SessionHostComponentUpdateType type() {
        return this.type;
    }

    /**
     * Set the type property: The type of maintenance for session host components.
     *
     * @param type the type value to set.
     * @return the AgentUpdateProperties object itself.
     */
    public AgentUpdateProperties withType(SessionHostComponentUpdateType type) {
        this.type = type;
        return this;
    }

    /**
     * Get the useSessionHostLocalTime property: Whether to use localTime of the virtual machine.
     *
     * @return the useSessionHostLocalTime value.
     */
    public Boolean useSessionHostLocalTime() {
        return this.useSessionHostLocalTime;
    }

    /**
     * Set the useSessionHostLocalTime property: Whether to use localTime of the virtual machine.
     *
     * @param useSessionHostLocalTime the useSessionHostLocalTime value to set.
     * @return the AgentUpdateProperties object itself.
     */
    public AgentUpdateProperties withUseSessionHostLocalTime(Boolean useSessionHostLocalTime) {
        this.useSessionHostLocalTime = useSessionHostLocalTime;
        return this;
    }

    /**
     * Get the maintenanceWindowTimeZone property: Time zone for maintenance as defined in
     * https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.findsystemtimezonebyid?view=net-5.0. Must be set
     * if useLocalTime is true.
     *
     * @return the maintenanceWindowTimeZone value.
     */
    public String maintenanceWindowTimeZone() {
        return this.maintenanceWindowTimeZone;
    }

    /**
     * Set the maintenanceWindowTimeZone property: Time zone for maintenance as defined in
     * https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.findsystemtimezonebyid?view=net-5.0. Must be set
     * if useLocalTime is true.
     *
     * @param maintenanceWindowTimeZone the maintenanceWindowTimeZone value to set.
     * @return the AgentUpdateProperties object itself.
     */
    public AgentUpdateProperties withMaintenanceWindowTimeZone(String maintenanceWindowTimeZone) {
        this.maintenanceWindowTimeZone = maintenanceWindowTimeZone;
        return this;
    }

    /**
     * Get the maintenanceWindows property: List of maintenance windows. Maintenance windows are 2 hours long.
     *
     * @return the maintenanceWindows value.
     */
    public List<MaintenanceWindowProperties> maintenanceWindows() {
        return this.maintenanceWindows;
    }

    /**
     * Set the maintenanceWindows property: List of maintenance windows. Maintenance windows are 2 hours long.
     *
     * @param maintenanceWindows the maintenanceWindows value to set.
     * @return the AgentUpdateProperties object itself.
     */
    public AgentUpdateProperties withMaintenanceWindows(List<MaintenanceWindowProperties> maintenanceWindows) {
        this.maintenanceWindows = maintenanceWindows;
        return this;
    }

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