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

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

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

/** Issue Comment contract Properties. */
@Fluent
public final class IssueCommentContractProperties {
    /*
     * Comment text.
     */
    @JsonProperty(value = "text", required = true)
    private String text;

    /*
     * Date and time when the comment was created.
     */
    @JsonProperty(value = "createdDate")
    private OffsetDateTime createdDate;

    /*
     * A resource identifier for the user who left the comment.
     */
    @JsonProperty(value = "userId", required = true)
    private String userId;

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

    /**
     * Set the text property: Comment text.
     *
     * @param text the text value to set.
     * @return the IssueCommentContractProperties object itself.
     */
    public IssueCommentContractProperties withText(String text) {
        this.text = text;
        return this;
    }

    /**
     * Get the createdDate property: Date and time when the comment was created.
     *
     * @return the createdDate value.
     */
    public OffsetDateTime createdDate() {
        return this.createdDate;
    }

    /**
     * Set the createdDate property: Date and time when the comment was created.
     *
     * @param createdDate the createdDate value to set.
     * @return the IssueCommentContractProperties object itself.
     */
    public IssueCommentContractProperties withCreatedDate(OffsetDateTime createdDate) {
        this.createdDate = createdDate;
        return this;
    }

    /**
     * Get the userId property: A resource identifier for the user who left the comment.
     *
     * @return the userId value.
     */
    public String userId() {
        return this.userId;
    }

    /**
     * Set the userId property: A resource identifier for the user who left the comment.
     *
     * @param userId the userId value to set.
     * @return the IssueCommentContractProperties object itself.
     */
    public IssueCommentContractProperties withUserId(String userId) {
        this.userId = userId;
        return this;
    }

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

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