// 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.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.time.OffsetDateTime;

/** Represents Activity timeline item. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind")
@JsonTypeName("Activity")
@Fluent
public final class ActivityTimelineItem extends EntityTimelineItem {
    /*
     * The activity query id.
     */
    @JsonProperty(value = "queryId", required = true)
    private String queryId;

    /*
     * The grouping bucket start time.
     */
    @JsonProperty(value = "bucketStartTimeUTC", required = true)
    private OffsetDateTime bucketStartTimeUtc;

    /*
     * The grouping bucket end time.
     */
    @JsonProperty(value = "bucketEndTimeUTC", required = true)
    private OffsetDateTime bucketEndTimeUtc;

    /*
     * The time of the first activity in the grouping bucket.
     */
    @JsonProperty(value = "firstActivityTimeUTC", required = true)
    private OffsetDateTime firstActivityTimeUtc;

    /*
     * The time of the last activity in the grouping bucket.
     */
    @JsonProperty(value = "lastActivityTimeUTC", required = true)
    private OffsetDateTime lastActivityTimeUtc;

    /*
     * The activity timeline content.
     */
    @JsonProperty(value = "content", required = true)
    private String content;

    /*
     * The activity timeline title.
     */
    @JsonProperty(value = "title", required = true)
    private String title;

    /**
     * Get the queryId property: The activity query id.
     *
     * @return the queryId value.
     */
    public String queryId() {
        return this.queryId;
    }

    /**
     * Set the queryId property: The activity query id.
     *
     * @param queryId the queryId value to set.
     * @return the ActivityTimelineItem object itself.
     */
    public ActivityTimelineItem withQueryId(String queryId) {
        this.queryId = queryId;
        return this;
    }

    /**
     * Get the bucketStartTimeUtc property: The grouping bucket start time.
     *
     * @return the bucketStartTimeUtc value.
     */
    public OffsetDateTime bucketStartTimeUtc() {
        return this.bucketStartTimeUtc;
    }

    /**
     * Set the bucketStartTimeUtc property: The grouping bucket start time.
     *
     * @param bucketStartTimeUtc the bucketStartTimeUtc value to set.
     * @return the ActivityTimelineItem object itself.
     */
    public ActivityTimelineItem withBucketStartTimeUtc(OffsetDateTime bucketStartTimeUtc) {
        this.bucketStartTimeUtc = bucketStartTimeUtc;
        return this;
    }

    /**
     * Get the bucketEndTimeUtc property: The grouping bucket end time.
     *
     * @return the bucketEndTimeUtc value.
     */
    public OffsetDateTime bucketEndTimeUtc() {
        return this.bucketEndTimeUtc;
    }

    /**
     * Set the bucketEndTimeUtc property: The grouping bucket end time.
     *
     * @param bucketEndTimeUtc the bucketEndTimeUtc value to set.
     * @return the ActivityTimelineItem object itself.
     */
    public ActivityTimelineItem withBucketEndTimeUtc(OffsetDateTime bucketEndTimeUtc) {
        this.bucketEndTimeUtc = bucketEndTimeUtc;
        return this;
    }

    /**
     * Get the firstActivityTimeUtc property: The time of the first activity in the grouping bucket.
     *
     * @return the firstActivityTimeUtc value.
     */
    public OffsetDateTime firstActivityTimeUtc() {
        return this.firstActivityTimeUtc;
    }

    /**
     * Set the firstActivityTimeUtc property: The time of the first activity in the grouping bucket.
     *
     * @param firstActivityTimeUtc the firstActivityTimeUtc value to set.
     * @return the ActivityTimelineItem object itself.
     */
    public ActivityTimelineItem withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc) {
        this.firstActivityTimeUtc = firstActivityTimeUtc;
        return this;
    }

    /**
     * Get the lastActivityTimeUtc property: The time of the last activity in the grouping bucket.
     *
     * @return the lastActivityTimeUtc value.
     */
    public OffsetDateTime lastActivityTimeUtc() {
        return this.lastActivityTimeUtc;
    }

    /**
     * Set the lastActivityTimeUtc property: The time of the last activity in the grouping bucket.
     *
     * @param lastActivityTimeUtc the lastActivityTimeUtc value to set.
     * @return the ActivityTimelineItem object itself.
     */
    public ActivityTimelineItem withLastActivityTimeUtc(OffsetDateTime lastActivityTimeUtc) {
        this.lastActivityTimeUtc = lastActivityTimeUtc;
        return this;
    }

    /**
     * Get the content property: The activity timeline content.
     *
     * @return the content value.
     */
    public String content() {
        return this.content;
    }

    /**
     * Set the content property: The activity timeline content.
     *
     * @param content the content value to set.
     * @return the ActivityTimelineItem object itself.
     */
    public ActivityTimelineItem withContent(String content) {
        this.content = content;
        return this;
    }

    /**
     * Get the title property: The activity timeline title.
     *
     * @return the title value.
     */
    public String title() {
        return this.title;
    }

    /**
     * Set the title property: The activity timeline title.
     *
     * @param title the title value to set.
     * @return the ActivityTimelineItem object itself.
     */
    public ActivityTimelineItem withTitle(String title) {
        this.title = title;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (queryId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property queryId in model ActivityTimelineItem"));
        }
        if (bucketStartTimeUtc() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property bucketStartTimeUtc in model ActivityTimelineItem"));
        }
        if (bucketEndTimeUtc() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property bucketEndTimeUtc in model ActivityTimelineItem"));
        }
        if (firstActivityTimeUtc() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property firstActivityTimeUtc in model ActivityTimelineItem"));
        }
        if (lastActivityTimeUtc() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property lastActivityTimeUtc in model ActivityTimelineItem"));
        }
        if (content() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property content in model ActivityTimelineItem"));
        }
        if (title() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property title in model ActivityTimelineItem"));
        }
    }

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