using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

namespace OpenAI.Chat;

// CUSTOM: Added Experimental attribute.
/// <summary>
/// Represents a chat message of the <c>developer</c> role as supplied to a chat completion request. A developer message is
/// generally supplied as the first message to a chat completion request and guides the model's behavior across future
/// <c>assistant</c> role response messages. These messages may help control behavior, style, tone, and
/// restrictions for a model-based assistant. Developer messages replace system messages for o1 models and newer.
/// </summary>
[Experimental("OPENAI001")]
[CodeGenType("ChatCompletionRequestDeveloperMessage")]
[CodeGenVisibility(nameof(DeveloperChatMessage), CodeGenVisibility.Internal)]
[CodeGenSuppress("DeveloperChatMessage", typeof(ChatMessageContent))]
public partial class DeveloperChatMessage : ChatMessage
{
    /// <summary>
    /// Creates a new instance of <see cref="DeveloperChatMessage"/> using a collection of content items.
    /// For <c>developer</c> messages, these can only be of type <c>text</c>.
    /// </summary>
    /// <param name="contentParts">
    ///     The collection of content items associated with the message.
    /// </param>
    public DeveloperChatMessage(IEnumerable<ChatMessageContentPart> contentParts)
        : this(new ChatMessageContent(contentParts), ChatMessageRole.Developer, null, null)
    { }

    /// <summary>
    /// Creates a new instance of <see cref="DeveloperChatMessage"/> using a collection of content items.
    /// For <c>developer</c> messages, these can only be of type <c>text</c>.
    /// </summary>
    /// <param name="contentParts">
    ///     The collection of content items associated with the message.
    /// </param>
    public DeveloperChatMessage(params ChatMessageContentPart[] contentParts)
        : this(new ChatMessageContent(contentParts), ChatMessageRole.Developer, null, null)
    {
        Argument.AssertNotNullOrEmpty(contentParts, nameof(contentParts));
    }

    /// <summary>
    /// Creates a new instance of <see cref="DeveloperChatMessage"/> with a single item of text content.
    /// </summary>
    /// <param name="content"> The text content of the message. </param>
    public DeveloperChatMessage(string content)
        : this(new ChatMessageContent([content]), ChatMessageRole.Developer, null, null)
    {
        Argument.AssertNotNull(content, nameof(content));
    }

    /// <summary>
    /// An optional <c>name</c> for the participant.
    /// </summary>
    [CodeGenMember("Name")]
    public string ParticipantName { get; set; }
}