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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.securityinsights.models.UserInfo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** Describes watchlist item properties. */
@Fluent
public final class WatchlistItemProperties {
    /*
     * The type of the watchlist item
     */
    @JsonProperty(value = "watchlistItemType")
    private String watchlistItemType;

    /*
     * The id (a Guid) of the watchlist item
     */
    @JsonProperty(value = "watchlistItemId")
    private String watchlistItemId;

    /*
     * The tenantId to which the watchlist item belongs to
     */
    @JsonProperty(value = "tenantId")
    private String tenantId;

    /*
     * A flag that indicates if the watchlist item is deleted or not
     */
    @JsonProperty(value = "isDeleted")
    private Boolean isDeleted;

    /*
     * The time the watchlist item was created
     */
    @JsonProperty(value = "created")
    private OffsetDateTime created;

    /*
     * The last time the watchlist item was updated
     */
    @JsonProperty(value = "updated")
    private OffsetDateTime updated;

    /*
     * Describes a user that created the watchlist item
     */
    @JsonProperty(value = "createdBy")
    private UserInfo createdBy;

    /*
     * Describes a user that updated the watchlist item
     */
    @JsonProperty(value = "updatedBy")
    private UserInfo updatedBy;

    /*
     * key-value pairs for a watchlist item
     */
    @JsonProperty(value = "itemsKeyValue", required = true)
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, Object> itemsKeyValue;

    /*
     * key-value pairs for a watchlist item entity mapping
     */
    @JsonProperty(value = "entityMapping")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, Object> entityMapping;

    /**
     * Get the watchlistItemType property: The type of the watchlist item.
     *
     * @return the watchlistItemType value.
     */
    public String watchlistItemType() {
        return this.watchlistItemType;
    }

    /**
     * Set the watchlistItemType property: The type of the watchlist item.
     *
     * @param watchlistItemType the watchlistItemType value to set.
     * @return the WatchlistItemProperties object itself.
     */
    public WatchlistItemProperties withWatchlistItemType(String watchlistItemType) {
        this.watchlistItemType = watchlistItemType;
        return this;
    }

    /**
     * Get the watchlistItemId property: The id (a Guid) of the watchlist item.
     *
     * @return the watchlistItemId value.
     */
    public String watchlistItemId() {
        return this.watchlistItemId;
    }

    /**
     * Set the watchlistItemId property: The id (a Guid) of the watchlist item.
     *
     * @param watchlistItemId the watchlistItemId value to set.
     * @return the WatchlistItemProperties object itself.
     */
    public WatchlistItemProperties withWatchlistItemId(String watchlistItemId) {
        this.watchlistItemId = watchlistItemId;
        return this;
    }

    /**
     * Get the tenantId property: The tenantId to which the watchlist item belongs to.
     *
     * @return the tenantId value.
     */
    public String tenantId() {
        return this.tenantId;
    }

    /**
     * Set the tenantId property: The tenantId to which the watchlist item belongs to.
     *
     * @param tenantId the tenantId value to set.
     * @return the WatchlistItemProperties object itself.
     */
    public WatchlistItemProperties withTenantId(String tenantId) {
        this.tenantId = tenantId;
        return this;
    }

    /**
     * Get the isDeleted property: A flag that indicates if the watchlist item is deleted or not.
     *
     * @return the isDeleted value.
     */
    public Boolean isDeleted() {
        return this.isDeleted;
    }

    /**
     * Set the isDeleted property: A flag that indicates if the watchlist item is deleted or not.
     *
     * @param isDeleted the isDeleted value to set.
     * @return the WatchlistItemProperties object itself.
     */
    public WatchlistItemProperties withIsDeleted(Boolean isDeleted) {
        this.isDeleted = isDeleted;
        return this;
    }

    /**
     * Get the created property: The time the watchlist item was created.
     *
     * @return the created value.
     */
    public OffsetDateTime created() {
        return this.created;
    }

    /**
     * Set the created property: The time the watchlist item was created.
     *
     * @param created the created value to set.
     * @return the WatchlistItemProperties object itself.
     */
    public WatchlistItemProperties withCreated(OffsetDateTime created) {
        this.created = created;
        return this;
    }

    /**
     * Get the updated property: The last time the watchlist item was updated.
     *
     * @return the updated value.
     */
    public OffsetDateTime updated() {
        return this.updated;
    }

    /**
     * Set the updated property: The last time the watchlist item was updated.
     *
     * @param updated the updated value to set.
     * @return the WatchlistItemProperties object itself.
     */
    public WatchlistItemProperties withUpdated(OffsetDateTime updated) {
        this.updated = updated;
        return this;
    }

    /**
     * Get the createdBy property: Describes a user that created the watchlist item.
     *
     * @return the createdBy value.
     */
    public UserInfo createdBy() {
        return this.createdBy;
    }

    /**
     * Set the createdBy property: Describes a user that created the watchlist item.
     *
     * @param createdBy the createdBy value to set.
     * @return the WatchlistItemProperties object itself.
     */
    public WatchlistItemProperties withCreatedBy(UserInfo createdBy) {
        this.createdBy = createdBy;
        return this;
    }

    /**
     * Get the updatedBy property: Describes a user that updated the watchlist item.
     *
     * @return the updatedBy value.
     */
    public UserInfo updatedBy() {
        return this.updatedBy;
    }

    /**
     * Set the updatedBy property: Describes a user that updated the watchlist item.
     *
     * @param updatedBy the updatedBy value to set.
     * @return the WatchlistItemProperties object itself.
     */
    public WatchlistItemProperties withUpdatedBy(UserInfo updatedBy) {
        this.updatedBy = updatedBy;
        return this;
    }

    /**
     * Get the itemsKeyValue property: key-value pairs for a watchlist item.
     *
     * @return the itemsKeyValue value.
     */
    public Map<String, Object> itemsKeyValue() {
        return this.itemsKeyValue;
    }

    /**
     * Set the itemsKeyValue property: key-value pairs for a watchlist item.
     *
     * @param itemsKeyValue the itemsKeyValue value to set.
     * @return the WatchlistItemProperties object itself.
     */
    public WatchlistItemProperties withItemsKeyValue(Map<String, Object> itemsKeyValue) {
        this.itemsKeyValue = itemsKeyValue;
        return this;
    }

    /**
     * Get the entityMapping property: key-value pairs for a watchlist item entity mapping.
     *
     * @return the entityMapping value.
     */
    public Map<String, Object> entityMapping() {
        return this.entityMapping;
    }

    /**
     * Set the entityMapping property: key-value pairs for a watchlist item entity mapping.
     *
     * @param entityMapping the entityMapping value to set.
     * @return the WatchlistItemProperties object itself.
     */
    public WatchlistItemProperties withEntityMapping(Map<String, Object> entityMapping) {
        this.entityMapping = entityMapping;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (createdBy() != null) {
            createdBy().validate();
        }
        if (updatedBy() != null) {
            updatedBy().validate();
        }
        if (itemsKeyValue() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property itemsKeyValue in model WatchlistItemProperties"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(WatchlistItemProperties.class);
}
