using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace OpenAI.Embeddings;

[CodeGenModel("CreateEmbeddingResponse")]
[CodeGenSuppress("Data")]
[CodeGenSuppress(nameof(OpenAIEmbeddingCollection))]
[CodeGenSuppress(nameof(OpenAIEmbeddingCollection), typeof(string), typeof(EmbeddingTokenUsage))]
[CodeGenSuppress(nameof(OpenAIEmbeddingCollection), typeof(string), typeof(EmbeddingTokenUsage),  typeof(InternalCreateEmbeddingResponseObject), typeof(IDictionary<string, BinaryData>))]
public partial class OpenAIEmbeddingCollection : ReadOnlyCollection<OpenAIEmbedding>
{
    // CUSTOM: Made private. This property does not add value in the context of a strongly-typed class.
    /// <summary> The object type, which is always "list". </summary>
    [CodeGenMember("Object")]
    private InternalCreateEmbeddingResponseObject Object { get; } = InternalCreateEmbeddingResponseObject.List;

    // CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
    /// <summary> Initializes a new instance of <see cref="OpenAIEmbeddingCollection"/>. </summary>
    /// <param name="data"> The list of embeddings generated by the model. </param>
    /// <param name="model"> The name of the model used to generate the embedding. </param>
    /// <param name="usage"> The usage information for the request. </param>
    /// <exception cref="ArgumentNullException"> <paramref name="data"/>, <paramref name="model"/> or <paramref name="usage"/> is null. </exception>
    internal OpenAIEmbeddingCollection(IEnumerable<OpenAIEmbedding> data, string model, EmbeddingTokenUsage usage)
        : base([.. data])
    {
        Argument.AssertNotNull(data, nameof(data));
        Argument.AssertNotNull(model, nameof(model));
        Argument.AssertNotNull(usage, nameof(usage));

        Model = model;
        Usage = usage;
    }

    // CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
    /// <summary> Initializes a new instance of <see cref="OpenAIEmbeddingCollection"/>. </summary>
    /// <param name="data"> The list of embeddings generated by the model. </param>
    /// <param name="model"> The name of the model used to generate the embedding. </param>
    /// <param name="object"> The object type, which is always "list". </param>
    /// <param name="usage"> The usage information for the request. </param>
    /// <param name="serializedAdditionalRawData"> Keeps track of any properties unknown to the library. </param>
    internal OpenAIEmbeddingCollection(IReadOnlyList<OpenAIEmbedding> data, string model, InternalCreateEmbeddingResponseObject @object, EmbeddingTokenUsage usage, IDictionary<string, BinaryData> serializedAdditionalRawData)
        : base([.. data])
    {
        Model = model;
        Object = @object;
        Usage = usage;
        SerializedAdditionalRawData = serializedAdditionalRawData;
    }

    // CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
    /// <summary> Initializes a new instance of <see cref="OpenAIEmbeddingCollection"/> for deserialization. </summary>
    internal OpenAIEmbeddingCollection()
        : base([])
    {
    }
}