// 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.ImpactType;
import com.azure.resourcemanager.maintenance.models.MaintenanceScope;
import com.azure.resourcemanager.maintenance.models.UpdateStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Maintenance update on a resource. */
@Fluent
public final class UpdateInner {
    /*
     * The impact area
     */
    @JsonProperty(value = "maintenanceScope")
    private MaintenanceScope maintenanceScope;

    /*
     * The impact type
     */
    @JsonProperty(value = "impactType")
    private ImpactType impactType;

    /*
     * The status
     */
    @JsonProperty(value = "status")
    private UpdateStatus status;

    /*
     * Duration of impact in seconds
     */
    @JsonProperty(value = "impactDurationInSec")
    private Integer impactDurationInSec;

    /*
     * Time when Azure will start force updates if not self-updated by customer before this time
     */
    @JsonProperty(value = "notBefore")
    private OffsetDateTime notBefore;

    /*
     * Properties of the apply update
     */
    @JsonProperty(value = "properties")
    private UpdateProperties innerProperties;

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

    /**
     * Get the maintenanceScope property: The impact area.
     *
     * @return the maintenanceScope value.
     */
    public MaintenanceScope maintenanceScope() {
        return this.maintenanceScope;
    }

    /**
     * Set the maintenanceScope property: The impact area.
     *
     * @param maintenanceScope the maintenanceScope value to set.
     * @return the UpdateInner object itself.
     */
    public UpdateInner withMaintenanceScope(MaintenanceScope maintenanceScope) {
        this.maintenanceScope = maintenanceScope;
        return this;
    }

    /**
     * Get the impactType property: The impact type.
     *
     * @return the impactType value.
     */
    public ImpactType impactType() {
        return this.impactType;
    }

    /**
     * Set the impactType property: The impact type.
     *
     * @param impactType the impactType value to set.
     * @return the UpdateInner object itself.
     */
    public UpdateInner withImpactType(ImpactType impactType) {
        this.impactType = impactType;
        return this;
    }

    /**
     * Get the status property: The status.
     *
     * @return the status value.
     */
    public UpdateStatus status() {
        return this.status;
    }

    /**
     * Set the status property: The status.
     *
     * @param status the status value to set.
     * @return the UpdateInner object itself.
     */
    public UpdateInner withStatus(UpdateStatus status) {
        this.status = status;
        return this;
    }

    /**
     * Get the impactDurationInSec property: Duration of impact in seconds.
     *
     * @return the impactDurationInSec value.
     */
    public Integer impactDurationInSec() {
        return this.impactDurationInSec;
    }

    /**
     * Set the impactDurationInSec property: Duration of impact in seconds.
     *
     * @param impactDurationInSec the impactDurationInSec value to set.
     * @return the UpdateInner object itself.
     */
    public UpdateInner withImpactDurationInSec(Integer impactDurationInSec) {
        this.impactDurationInSec = impactDurationInSec;
        return this;
    }

    /**
     * Get the notBefore property: Time when Azure will start force updates if not self-updated by customer before this
     * time.
     *
     * @return the notBefore value.
     */
    public OffsetDateTime notBefore() {
        return this.notBefore;
    }

    /**
     * Set the notBefore property: Time when Azure will start force updates if not self-updated by customer before this
     * time.
     *
     * @param notBefore the notBefore value to set.
     * @return the UpdateInner object itself.
     */
    public UpdateInner withNotBefore(OffsetDateTime notBefore) {
        this.notBefore = notBefore;
        return this;
    }

    /**
     * Get the innerProperties property: Properties of the apply update.
     *
     * @return the innerProperties value.
     */
    private UpdateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the resourceId property: The resourceId.
     *
     * @return the resourceId value.
     */
    public String resourceId() {
        return this.innerProperties() == null ? null : this.innerProperties().resourceId();
    }

    /**
     * Set the resourceId property: The resourceId.
     *
     * @param resourceId the resourceId value to set.
     * @return the UpdateInner object itself.
     */
    public UpdateInner withResourceId(String resourceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateProperties();
        }
        this.innerProperties().withResourceId(resourceId);
        return this;
    }

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