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

package com.azure.resourcemanager.policyinsights.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;

/** Component event details. */
@Fluent
public final class ComponentEventDetails {
    /*
     * Component Id.
     */
    @JsonProperty(value = "id")
    private String id;

    /*
     * Component type.
     */
    @JsonProperty(value = "type")
    private String type;

    /*
     * Component name.
     */
    @JsonProperty(value = "name")
    private String name;

    /*
     * Timestamp for component policy event record.
     */
    @JsonProperty(value = "timestamp")
    private OffsetDateTime timestamp;

    /*
     * Tenant ID for the policy event record.
     */
    @JsonProperty(value = "tenantId")
    private String tenantId;

    /*
     * Principal object ID for the user who initiated the resource component operation that triggered the policy event.
     */
    @JsonProperty(value = "principalOid")
    private String principalOid;

    /*
     * Policy definition action, i.e. effect.
     */
    @JsonProperty(value = "policyDefinitionAction")
    private String policyDefinitionAction;

    /*
     * Component event details.
     */
    @JsonIgnore private Map<String, Object> additionalProperties;

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

    /**
     * Get the id property: Component Id.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Set the id property: Component Id.
     *
     * @param id the id value to set.
     * @return the ComponentEventDetails object itself.
     */
    public ComponentEventDetails withId(String id) {
        this.id = id;
        return this;
    }

    /**
     * Get the type property: Component type.
     *
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Set the type property: Component type.
     *
     * @param type the type value to set.
     * @return the ComponentEventDetails object itself.
     */
    public ComponentEventDetails withType(String type) {
        this.type = type;
        return this;
    }

    /**
     * Get the name property: Component name.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Component name.
     *
     * @param name the name value to set.
     * @return the ComponentEventDetails object itself.
     */
    public ComponentEventDetails withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the timestamp property: Timestamp for component policy event record.
     *
     * @return the timestamp value.
     */
    public OffsetDateTime timestamp() {
        return this.timestamp;
    }

    /**
     * Set the timestamp property: Timestamp for component policy event record.
     *
     * @param timestamp the timestamp value to set.
     * @return the ComponentEventDetails object itself.
     */
    public ComponentEventDetails withTimestamp(OffsetDateTime timestamp) {
        this.timestamp = timestamp;
        return this;
    }

    /**
     * Get the tenantId property: Tenant ID for the policy event record.
     *
     * @return the tenantId value.
     */
    public String tenantId() {
        return this.tenantId;
    }

    /**
     * Set the tenantId property: Tenant ID for the policy event record.
     *
     * @param tenantId the tenantId value to set.
     * @return the ComponentEventDetails object itself.
     */
    public ComponentEventDetails withTenantId(String tenantId) {
        this.tenantId = tenantId;
        return this;
    }

    /**
     * Get the principalOid property: Principal object ID for the user who initiated the resource component operation
     * that triggered the policy event.
     *
     * @return the principalOid value.
     */
    public String principalOid() {
        return this.principalOid;
    }

    /**
     * Set the principalOid property: Principal object ID for the user who initiated the resource component operation
     * that triggered the policy event.
     *
     * @param principalOid the principalOid value to set.
     * @return the ComponentEventDetails object itself.
     */
    public ComponentEventDetails withPrincipalOid(String principalOid) {
        this.principalOid = principalOid;
        return this;
    }

    /**
     * Get the policyDefinitionAction property: Policy definition action, i.e. effect.
     *
     * @return the policyDefinitionAction value.
     */
    public String policyDefinitionAction() {
        return this.policyDefinitionAction;
    }

    /**
     * Set the policyDefinitionAction property: Policy definition action, i.e. effect.
     *
     * @param policyDefinitionAction the policyDefinitionAction value to set.
     * @return the ComponentEventDetails object itself.
     */
    public ComponentEventDetails withPolicyDefinitionAction(String policyDefinitionAction) {
        this.policyDefinitionAction = policyDefinitionAction;
        return this;
    }

    /**
     * Get the additionalProperties property: Component event details.
     *
     * @return the additionalProperties value.
     */
    @JsonAnyGetter
    public Map<String, Object> additionalProperties() {
        return this.additionalProperties;
    }

    /**
     * Set the additionalProperties property: Component event details.
     *
     * @param additionalProperties the additionalProperties value to set.
     * @return the ComponentEventDetails object itself.
     */
    public ComponentEventDetails withAdditionalProperties(Map<String, Object> additionalProperties) {
        this.additionalProperties = additionalProperties;
        return this;
    }

    @JsonAnySetter
    void withAdditionalProperties(String key, Object value) {
        if (additionalProperties == null) {
            additionalProperties = new HashMap<>();
        }
        additionalProperties.put(key, value);
    }

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