// 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.ClientInfo;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Incident comment property bag. */
@Fluent
public final class IncidentCommentProperties {
    /*
     * The time the comment was created
     */
    @JsonProperty(value = "createdTimeUtc", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime createdTimeUtc;

    /*
     * The time the comment was updated
     */
    @JsonProperty(value = "lastModifiedTimeUtc", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime lastModifiedTimeUtc;

    /*
     * The comment message
     */
    @JsonProperty(value = "message", required = true)
    private String message;

    /*
     * Describes the client that created the comment
     */
    @JsonProperty(value = "author", access = JsonProperty.Access.WRITE_ONLY)
    private ClientInfo author;

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

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

    /**
     * Get the message property: The comment message.
     *
     * @return the message value.
     */
    public String message() {
        return this.message;
    }

    /**
     * Set the message property: The comment message.
     *
     * @param message the message value to set.
     * @return the IncidentCommentProperties object itself.
     */
    public IncidentCommentProperties withMessage(String message) {
        this.message = message;
        return this;
    }

    /**
     * Get the author property: Describes the client that created the comment.
     *
     * @return the author value.
     */
    public ClientInfo author() {
        return this.author;
    }

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

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