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

package com.azure.resourcemanager.maintenance.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.maintenance.models.MaintenanceScope;
import com.azure.resourcemanager.maintenance.models.Visibility;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Properties for maintenance configuration. */
@Fluent
public final class MaintenanceConfigurationProperties {
    /*
     * Gets or sets namespace of the resource
     */
    @JsonProperty(value = "namespace")
    private String namespace;

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

    /*
     * Gets or sets maintenanceScope of the configuration
     */
    @JsonProperty(value = "maintenanceScope")
    private MaintenanceScope maintenanceScope;

    /*
     * Definition of a MaintenanceWindow
     */
    @JsonProperty(value = "maintenanceWindow")
    private MaintenanceWindow innerMaintenanceWindow;

    /*
     * Gets or sets the visibility of the configuration. The default value is 'Custom'
     */
    @JsonProperty(value = "visibility")
    private Visibility visibility;

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

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

    /**
     * Set the namespace property: Gets or sets namespace of the resource.
     *
     * @param namespace the namespace value to set.
     * @return the MaintenanceConfigurationProperties object itself.
     */
    public MaintenanceConfigurationProperties withNamespace(String namespace) {
        this.namespace = namespace;
        return this;
    }

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

    /**
     * Set the extensionProperties property: Gets or sets extensionProperties of the maintenanceConfiguration.
     *
     * @param extensionProperties the extensionProperties value to set.
     * @return the MaintenanceConfigurationProperties object itself.
     */
    public MaintenanceConfigurationProperties withExtensionProperties(Map<String, String> extensionProperties) {
        this.extensionProperties = extensionProperties;
        return this;
    }

    /**
     * Get the maintenanceScope property: Gets or sets maintenanceScope of the configuration.
     *
     * @return the maintenanceScope value.
     */
    public MaintenanceScope maintenanceScope() {
        return this.maintenanceScope;
    }

    /**
     * Set the maintenanceScope property: Gets or sets maintenanceScope of the configuration.
     *
     * @param maintenanceScope the maintenanceScope value to set.
     * @return the MaintenanceConfigurationProperties object itself.
     */
    public MaintenanceConfigurationProperties withMaintenanceScope(MaintenanceScope maintenanceScope) {
        this.maintenanceScope = maintenanceScope;
        return this;
    }

    /**
     * Get the innerMaintenanceWindow property: Definition of a MaintenanceWindow.
     *
     * @return the innerMaintenanceWindow value.
     */
    private MaintenanceWindow innerMaintenanceWindow() {
        return this.innerMaintenanceWindow;
    }

    /**
     * Get the visibility property: Gets or sets the visibility of the configuration. The default value is 'Custom'.
     *
     * @return the visibility value.
     */
    public Visibility visibility() {
        return this.visibility;
    }

    /**
     * Set the visibility property: Gets or sets the visibility of the configuration. The default value is 'Custom'.
     *
     * @param visibility the visibility value to set.
     * @return the MaintenanceConfigurationProperties object itself.
     */
    public MaintenanceConfigurationProperties withVisibility(Visibility visibility) {
        this.visibility = visibility;
        return this;
    }

    /**
     * Get the startDateTime property: Effective start date of the maintenance window in YYYY-MM-DD hh:mm format. The
     * start date can be set to either the current date or future date. The window will be created in the time zone
     * provided and adjusted to daylight savings according to that time zone.
     *
     * @return the startDateTime value.
     */
    public String startDateTime() {
        return this.innerMaintenanceWindow() == null ? null : this.innerMaintenanceWindow().startDateTime();
    }

    /**
     * Set the startDateTime property: Effective start date of the maintenance window in YYYY-MM-DD hh:mm format. The
     * start date can be set to either the current date or future date. The window will be created in the time zone
     * provided and adjusted to daylight savings according to that time zone.
     *
     * @param startDateTime the startDateTime value to set.
     * @return the MaintenanceConfigurationProperties object itself.
     */
    public MaintenanceConfigurationProperties withStartDateTime(String startDateTime) {
        if (this.innerMaintenanceWindow() == null) {
            this.innerMaintenanceWindow = new MaintenanceWindow();
        }
        this.innerMaintenanceWindow().withStartDateTime(startDateTime);
        return this;
    }

    /**
     * Get the expirationDateTime property: Effective expiration date of the maintenance window in YYYY-MM-DD hh:mm
     * format. The window will be created in the time zone provided and adjusted to daylight savings according to that
     * time zone. Expiration date must be set to a future date. If not provided, it will be set to the maximum datetime
     * 9999-12-31 23:59:59.
     *
     * @return the expirationDateTime value.
     */
    public String expirationDateTime() {
        return this.innerMaintenanceWindow() == null ? null : this.innerMaintenanceWindow().expirationDateTime();
    }

    /**
     * Set the expirationDateTime property: Effective expiration date of the maintenance window in YYYY-MM-DD hh:mm
     * format. The window will be created in the time zone provided and adjusted to daylight savings according to that
     * time zone. Expiration date must be set to a future date. If not provided, it will be set to the maximum datetime
     * 9999-12-31 23:59:59.
     *
     * @param expirationDateTime the expirationDateTime value to set.
     * @return the MaintenanceConfigurationProperties object itself.
     */
    public MaintenanceConfigurationProperties withExpirationDateTime(String expirationDateTime) {
        if (this.innerMaintenanceWindow() == null) {
            this.innerMaintenanceWindow = new MaintenanceWindow();
        }
        this.innerMaintenanceWindow().withExpirationDateTime(expirationDateTime);
        return this;
    }

    /**
     * Get the duration property: Duration of the maintenance window in HH:mm format. If not provided, default value
     * will be used based on maintenance scope provided. Example: 05:00.
     *
     * @return the duration value.
     */
    public String duration() {
        return this.innerMaintenanceWindow() == null ? null : this.innerMaintenanceWindow().duration();
    }

    /**
     * Set the duration property: Duration of the maintenance window in HH:mm format. If not provided, default value
     * will be used based on maintenance scope provided. Example: 05:00.
     *
     * @param duration the duration value to set.
     * @return the MaintenanceConfigurationProperties object itself.
     */
    public MaintenanceConfigurationProperties withDuration(String duration) {
        if (this.innerMaintenanceWindow() == null) {
            this.innerMaintenanceWindow = new MaintenanceWindow();
        }
        this.innerMaintenanceWindow().withDuration(duration);
        return this;
    }

    /**
     * Get the timeZone property: Name of the timezone. List of timezones can be obtained by executing
     * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. Example: Pacific Standard Time, UTC, W. Europe
     * Standard Time, Korea Standard Time, Cen. Australia Standard Time.
     *
     * @return the timeZone value.
     */
    public String timeZone() {
        return this.innerMaintenanceWindow() == null ? null : this.innerMaintenanceWindow().timeZone();
    }

    /**
     * Set the timeZone property: Name of the timezone. List of timezones can be obtained by executing
     * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. Example: Pacific Standard Time, UTC, W. Europe
     * Standard Time, Korea Standard Time, Cen. Australia Standard Time.
     *
     * @param timeZone the timeZone value to set.
     * @return the MaintenanceConfigurationProperties object itself.
     */
    public MaintenanceConfigurationProperties withTimeZone(String timeZone) {
        if (this.innerMaintenanceWindow() == null) {
            this.innerMaintenanceWindow = new MaintenanceWindow();
        }
        this.innerMaintenanceWindow().withTimeZone(timeZone);
        return this;
    }

    /**
     * Get the recurEvery property: Rate at which a Maintenance window is expected to recur. The rate can be expressed
     * as daily, weekly, or monthly schedules. Daily schedule are formatted as recurEvery: [Frequency as
     * integer]['Day(s)']. If no frequency is provided, the default frequency is 1. Daily schedule examples are
     * recurEvery: Day, recurEvery: 3Days. Weekly schedule are formatted as recurEvery: [Frequency as
     * integer]['Week(s)'] [Optional comma separated list of weekdays Monday-Sunday]. Weekly schedule examples are
     * recurEvery: 3Weeks, recurEvery: Week Saturday,Sunday. Monthly schedules are formatted as [Frequency as
     * integer]['Month(s)'] [Comma separated list of month days] or [Frequency as integer]['Month(s)'] [Week of Month
     * (First, Second, Third, Fourth, Last)] [Weekday Monday-Sunday]. Monthly schedule examples are recurEvery: Month,
     * recurEvery: 2Months, recurEvery: Month day23,day24, recurEvery: Month Last Sunday, recurEvery: Month Fourth
     * Monday.
     *
     * @return the recurEvery value.
     */
    public String recurEvery() {
        return this.innerMaintenanceWindow() == null ? null : this.innerMaintenanceWindow().recurEvery();
    }

    /**
     * Set the recurEvery property: Rate at which a Maintenance window is expected to recur. The rate can be expressed
     * as daily, weekly, or monthly schedules. Daily schedule are formatted as recurEvery: [Frequency as
     * integer]['Day(s)']. If no frequency is provided, the default frequency is 1. Daily schedule examples are
     * recurEvery: Day, recurEvery: 3Days. Weekly schedule are formatted as recurEvery: [Frequency as
     * integer]['Week(s)'] [Optional comma separated list of weekdays Monday-Sunday]. Weekly schedule examples are
     * recurEvery: 3Weeks, recurEvery: Week Saturday,Sunday. Monthly schedules are formatted as [Frequency as
     * integer]['Month(s)'] [Comma separated list of month days] or [Frequency as integer]['Month(s)'] [Week of Month
     * (First, Second, Third, Fourth, Last)] [Weekday Monday-Sunday]. Monthly schedule examples are recurEvery: Month,
     * recurEvery: 2Months, recurEvery: Month day23,day24, recurEvery: Month Last Sunday, recurEvery: Month Fourth
     * Monday.
     *
     * @param recurEvery the recurEvery value to set.
     * @return the MaintenanceConfigurationProperties object itself.
     */
    public MaintenanceConfigurationProperties withRecurEvery(String recurEvery) {
        if (this.innerMaintenanceWindow() == null) {
            this.innerMaintenanceWindow = new MaintenanceWindow();
        }
        this.innerMaintenanceWindow().withRecurEvery(recurEvery);
        return this;
    }

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