// 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.SourceType;
import com.azure.resourcemanager.securityinsights.models.UserInfo;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.List;

/** Describes watchlist properties. */
@Fluent
public final class WatchlistProperties {
    /*
     * The id (a Guid) of the watchlist
     */
    @JsonProperty(value = "watchlistId")
    private String watchlistId;

    /*
     * The display name of the watchlist
     */
    @JsonProperty(value = "displayName", required = true)
    private String displayName;

    /*
     * The provider of the watchlist
     */
    @JsonProperty(value = "provider", required = true)
    private String provider;

    /*
     * The filename of the watchlist, called 'source'
     */
    @JsonProperty(value = "source")
    private String source;

    /*
     * The sourceType of the watchlist
     */
    @JsonProperty(value = "sourceType")
    private SourceType sourceType;

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

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

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

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

    /*
     * A description of the watchlist
     */
    @JsonProperty(value = "description")
    private String description;

    /*
     * The type of the watchlist
     */
    @JsonProperty(value = "watchlistType")
    private String watchlistType;

    /*
     * The alias of the watchlist
     */
    @JsonProperty(value = "watchlistAlias")
    private String watchlistAlias;

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

    /*
     * List of labels relevant to this watchlist
     */
    @JsonProperty(value = "labels")
    private List<String> labels;

    /*
     * The default duration of a watchlist (in ISO 8601 duration format)
     */
    @JsonProperty(value = "defaultDuration")
    private Duration defaultDuration;

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

    /*
     * The number of lines in a csv/tsv content to skip before the header
     */
    @JsonProperty(value = "numberOfLinesToSkip")
    private Integer numberOfLinesToSkip;

    /*
     * The raw content that represents to watchlist items to create. In case of csv/tsv content type, it's the content
     * of the file that will parsed by the endpoint
     */
    @JsonProperty(value = "rawContent")
    private String rawContent;

    /*
     * The search key is used to optimize query performance when using watchlists for joins with other data. For
     * example, enable a column with IP addresses to be the designated SearchKey field, then use this field as the key
     * field when joining to other event data by IP address.
     */
    @JsonProperty(value = "itemsSearchKey", required = true)
    private String itemsSearchKey;

    /*
     * The content type of the raw content. Example : text/csv or text/tsv
     */
    @JsonProperty(value = "contentType")
    private String contentType;

    /*
     * The status of the Watchlist upload : New, InProgress or Complete. Pls note : When a Watchlist upload status is
     * equal to InProgress, the Watchlist cannot be deleted
     */
    @JsonProperty(value = "uploadStatus")
    private String uploadStatus;

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

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

    /**
     * Get the displayName property: The display name of the watchlist.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: The display name of the watchlist.
     *
     * @param displayName the displayName value to set.
     * @return the WatchlistProperties object itself.
     */
    public WatchlistProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

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

    /**
     * Set the provider property: The provider of the watchlist.
     *
     * @param provider the provider value to set.
     * @return the WatchlistProperties object itself.
     */
    public WatchlistProperties withProvider(String provider) {
        this.provider = provider;
        return this;
    }

    /**
     * Get the source property: The filename of the watchlist, called 'source'.
     *
     * @return the source value.
     */
    public String source() {
        return this.source;
    }

    /**
     * Set the source property: The filename of the watchlist, called 'source'.
     *
     * @param source the source value to set.
     * @return the WatchlistProperties object itself.
     */
    public WatchlistProperties withSource(String source) {
        this.source = source;
        return this;
    }

    /**
     * Get the sourceType property: The sourceType of the watchlist.
     *
     * @return the sourceType value.
     */
    public SourceType sourceType() {
        return this.sourceType;
    }

    /**
     * Set the sourceType property: The sourceType of the watchlist.
     *
     * @param sourceType the sourceType value to set.
     * @return the WatchlistProperties object itself.
     */
    public WatchlistProperties withSourceType(SourceType sourceType) {
        this.sourceType = sourceType;
        return this;
    }

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

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

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

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

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

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

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

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

    /**
     * Get the description property: A description of the watchlist.
     *
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: A description of the watchlist.
     *
     * @param description the description value to set.
     * @return the WatchlistProperties object itself.
     */
    public WatchlistProperties withDescription(String description) {
        this.description = description;
        return this;
    }

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

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

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

    /**
     * Set the watchlistAlias property: The alias of the watchlist.
     *
     * @param watchlistAlias the watchlistAlias value to set.
     * @return the WatchlistProperties object itself.
     */
    public WatchlistProperties withWatchlistAlias(String watchlistAlias) {
        this.watchlistAlias = watchlistAlias;
        return this;
    }

    /**
     * Get the isDeleted property: A flag that indicates if the watchlist 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 is deleted or not.
     *
     * @param isDeleted the isDeleted value to set.
     * @return the WatchlistProperties object itself.
     */
    public WatchlistProperties withIsDeleted(Boolean isDeleted) {
        this.isDeleted = isDeleted;
        return this;
    }

    /**
     * Get the labels property: List of labels relevant to this watchlist.
     *
     * @return the labels value.
     */
    public List<String> labels() {
        return this.labels;
    }

    /**
     * Set the labels property: List of labels relevant to this watchlist.
     *
     * @param labels the labels value to set.
     * @return the WatchlistProperties object itself.
     */
    public WatchlistProperties withLabels(List<String> labels) {
        this.labels = labels;
        return this;
    }

    /**
     * Get the defaultDuration property: The default duration of a watchlist (in ISO 8601 duration format).
     *
     * @return the defaultDuration value.
     */
    public Duration defaultDuration() {
        return this.defaultDuration;
    }

    /**
     * Set the defaultDuration property: The default duration of a watchlist (in ISO 8601 duration format).
     *
     * @param defaultDuration the defaultDuration value to set.
     * @return the WatchlistProperties object itself.
     */
    public WatchlistProperties withDefaultDuration(Duration defaultDuration) {
        this.defaultDuration = defaultDuration;
        return this;
    }

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

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

    /**
     * Get the numberOfLinesToSkip property: The number of lines in a csv/tsv content to skip before the header.
     *
     * @return the numberOfLinesToSkip value.
     */
    public Integer numberOfLinesToSkip() {
        return this.numberOfLinesToSkip;
    }

    /**
     * Set the numberOfLinesToSkip property: The number of lines in a csv/tsv content to skip before the header.
     *
     * @param numberOfLinesToSkip the numberOfLinesToSkip value to set.
     * @return the WatchlistProperties object itself.
     */
    public WatchlistProperties withNumberOfLinesToSkip(Integer numberOfLinesToSkip) {
        this.numberOfLinesToSkip = numberOfLinesToSkip;
        return this;
    }

    /**
     * Get the rawContent property: The raw content that represents to watchlist items to create. In case of csv/tsv
     * content type, it's the content of the file that will parsed by the endpoint.
     *
     * @return the rawContent value.
     */
    public String rawContent() {
        return this.rawContent;
    }

    /**
     * Set the rawContent property: The raw content that represents to watchlist items to create. In case of csv/tsv
     * content type, it's the content of the file that will parsed by the endpoint.
     *
     * @param rawContent the rawContent value to set.
     * @return the WatchlistProperties object itself.
     */
    public WatchlistProperties withRawContent(String rawContent) {
        this.rawContent = rawContent;
        return this;
    }

    /**
     * Get the itemsSearchKey property: The search key is used to optimize query performance when using watchlists for
     * joins with other data. For example, enable a column with IP addresses to be the designated SearchKey field, then
     * use this field as the key field when joining to other event data by IP address.
     *
     * @return the itemsSearchKey value.
     */
    public String itemsSearchKey() {
        return this.itemsSearchKey;
    }

    /**
     * Set the itemsSearchKey property: The search key is used to optimize query performance when using watchlists for
     * joins with other data. For example, enable a column with IP addresses to be the designated SearchKey field, then
     * use this field as the key field when joining to other event data by IP address.
     *
     * @param itemsSearchKey the itemsSearchKey value to set.
     * @return the WatchlistProperties object itself.
     */
    public WatchlistProperties withItemsSearchKey(String itemsSearchKey) {
        this.itemsSearchKey = itemsSearchKey;
        return this;
    }

    /**
     * Get the contentType property: The content type of the raw content. Example : text/csv or text/tsv.
     *
     * @return the contentType value.
     */
    public String contentType() {
        return this.contentType;
    }

    /**
     * Set the contentType property: The content type of the raw content. Example : text/csv or text/tsv.
     *
     * @param contentType the contentType value to set.
     * @return the WatchlistProperties object itself.
     */
    public WatchlistProperties withContentType(String contentType) {
        this.contentType = contentType;
        return this;
    }

    /**
     * Get the uploadStatus property: The status of the Watchlist upload : New, InProgress or Complete. Pls note : When
     * a Watchlist upload status is equal to InProgress, the Watchlist cannot be deleted.
     *
     * @return the uploadStatus value.
     */
    public String uploadStatus() {
        return this.uploadStatus;
    }

    /**
     * Set the uploadStatus property: The status of the Watchlist upload : New, InProgress or Complete. Pls note : When
     * a Watchlist upload status is equal to InProgress, the Watchlist cannot be deleted.
     *
     * @param uploadStatus the uploadStatus value to set.
     * @return the WatchlistProperties object itself.
     */
    public WatchlistProperties withUploadStatus(String uploadStatus) {
        this.uploadStatus = uploadStatus;
        return this;
    }

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

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