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

package com.azure.resourcemanager.changeanalysis.models;

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

/** The properties of a change. */
@Fluent
public final class ChangeProperties {
    /*
     * The resource id that the change is attached to.
     */
    @JsonProperty(value = "resourceId")
    private String resourceId;

    /*
     * The time when the change is detected.
     */
    @JsonProperty(value = "timeStamp")
    private OffsetDateTime timestamp;

    /*
     * The list of identities who might initiated the change.
     * The identity could be user name (email address) or the object ID of the Service Principal.
     */
    @JsonProperty(value = "initiatedByList")
    private List<String> initiatedByList;

    /*
     * The type of the change.
     */
    @JsonProperty(value = "changeType")
    private ChangeType changeType;

    /*
     * The list of detailed changes at json property level.
     */
    @JsonProperty(value = "propertyChanges")
    private List<PropertyChange> propertyChanges;

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

    /**
     * Get the resourceId property: The resource id that the change is attached to.
     *
     * @return the resourceId value.
     */
    public String resourceId() {
        return this.resourceId;
    }

    /**
     * Set the resourceId property: The resource id that the change is attached to.
     *
     * @param resourceId the resourceId value to set.
     * @return the ChangeProperties object itself.
     */
    public ChangeProperties withResourceId(String resourceId) {
        this.resourceId = resourceId;
        return this;
    }

    /**
     * Get the timestamp property: The time when the change is detected.
     *
     * @return the timestamp value.
     */
    public OffsetDateTime timestamp() {
        return this.timestamp;
    }

    /**
     * Set the timestamp property: The time when the change is detected.
     *
     * @param timestamp the timestamp value to set.
     * @return the ChangeProperties object itself.
     */
    public ChangeProperties withTimestamp(OffsetDateTime timestamp) {
        this.timestamp = timestamp;
        return this;
    }

    /**
     * Get the initiatedByList property: The list of identities who might initiated the change. The identity could be
     * user name (email address) or the object ID of the Service Principal.
     *
     * @return the initiatedByList value.
     */
    public List<String> initiatedByList() {
        return this.initiatedByList;
    }

    /**
     * Set the initiatedByList property: The list of identities who might initiated the change. The identity could be
     * user name (email address) or the object ID of the Service Principal.
     *
     * @param initiatedByList the initiatedByList value to set.
     * @return the ChangeProperties object itself.
     */
    public ChangeProperties withInitiatedByList(List<String> initiatedByList) {
        this.initiatedByList = initiatedByList;
        return this;
    }

    /**
     * Get the changeType property: The type of the change.
     *
     * @return the changeType value.
     */
    public ChangeType changeType() {
        return this.changeType;
    }

    /**
     * Set the changeType property: The type of the change.
     *
     * @param changeType the changeType value to set.
     * @return the ChangeProperties object itself.
     */
    public ChangeProperties withChangeType(ChangeType changeType) {
        this.changeType = changeType;
        return this;
    }

    /**
     * Get the propertyChanges property: The list of detailed changes at json property level.
     *
     * @return the propertyChanges value.
     */
    public List<PropertyChange> propertyChanges() {
        return this.propertyChanges;
    }

    /**
     * Set the propertyChanges property: The list of detailed changes at json property level.
     *
     * @param propertyChanges the propertyChanges value to set.
     * @return the ChangeProperties object itself.
     */
    public ChangeProperties withPropertyChanges(List<PropertyChange> propertyChanges) {
        this.propertyChanges = propertyChanges;
        return this;
    }

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