/*
 * Copyright 2025 The Dapr Authors
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *     http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
limitations under the License.
*/

package io.dapr.client.domain;

import java.util.List;

/**
 * Represents a conversation result message with content and optional tool calls.
 */
public class ConversationResultMessage {

  private final String content;
  private final List<ConversationToolCalls> toolCalls;

  /**
   * Constructor.
   *
   * @param content the contents of the message
   * @param toolCalls the tool calls generated by the model (optional)
   */
  public ConversationResultMessage(String content, List<ConversationToolCalls> toolCalls) {
    this.content = content;
    this.toolCalls = toolCalls != null ? List.copyOf(toolCalls) : null;
  }

  /**
   * Constructor for message without tool calls.
   *
   * @param content the contents of the message
   */
  public ConversationResultMessage(String content) {
    this(content, null);
  }

  /**
   * Gets the contents of the message.
   *
   * @return the message content
   */
  public String getContent() {
    return content;
  }

  /**
   * Gets the tool calls generated by the model.
   *
   * @return the tool calls, or null if none
   */
  public List<ConversationToolCalls> getToolCalls() {
    return toolCalls;
  }

  /**
   * Checks if the message has tool calls.
   *
   * @return true if there are tool calls, false otherwise
   */
  public boolean hasToolCalls() {
    return toolCalls != null && !toolCalls.isEmpty();
  }
}
