// <auto-generated/>

#nullable disable

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using OpenAI;
using OpenAI.Internal;

namespace OpenAI.Responses
{
    [Experimental("OPENAI001")]
    public partial class OpenAIResponse
    {
        private protected IDictionary<string, BinaryData> _additionalBinaryDataProperties;

        internal OpenAIResponse(IDictionary<string, string> metadata, float? temperature, float? topP, string id, DateTimeOffset createdAt, ResponseError error, string endUserId, ResponseIncompleteStatusDetails incompleteStatusDetails, IEnumerable<ResponseItem> outputItems, bool parallelToolCallsEnabled)
        {
            // Plugin customization: ensure initialization of collections
            Metadata = metadata ?? new ChangeTrackingDictionary<string, string>();
            Temperature = temperature;
            TopP = topP;
            Tools = new ChangeTrackingList<ResponseTool>();
            Id = id;
            CreatedAt = createdAt;
            Error = error;
            EndUserId = endUserId;
            IncompleteStatusDetails = incompleteStatusDetails;
            OutputItems = outputItems.ToList();
            ParallelToolCallsEnabled = parallelToolCallsEnabled;
        }

        internal OpenAIResponse(IDictionary<string, string> metadata, float? temperature, float? topP, InternalServiceTier? serviceTier, string previousResponseId, bool? background, string instructions, IList<ResponseTool> tools, string id, ResponseStatus? status, DateTimeOffset createdAt, ResponseError error, ResponseTokenUsage usage, string endUserId, ResponseReasoningOptions reasoningOptions, int? maxOutputTokenCount, ResponseTextOptions textOptions, ResponseTruncationMode? truncationMode, ResponseIncompleteStatusDetails incompleteStatusDetails, IList<ResponseItem> outputItems, bool parallelToolCallsEnabled, ResponseToolChoice toolChoice, string model, string @object, IDictionary<string, BinaryData> additionalBinaryDataProperties)
        {
            // Plugin customization: ensure initialization of collections
            Metadata = metadata ?? new ChangeTrackingDictionary<string, string>();
            Temperature = temperature;
            TopP = topP;
            ServiceTier = serviceTier;
            PreviousResponseId = previousResponseId;
            Background = background;
            Instructions = instructions;
            Tools = tools ?? new ChangeTrackingList<ResponseTool>();
            Id = id;
            Status = status;
            CreatedAt = createdAt;
            Error = error;
            Usage = usage;
            EndUserId = endUserId;
            ReasoningOptions = reasoningOptions;
            MaxOutputTokenCount = maxOutputTokenCount;
            TextOptions = textOptions;
            TruncationMode = truncationMode;
            IncompleteStatusDetails = incompleteStatusDetails;
            OutputItems = outputItems ?? new ChangeTrackingList<ResponseItem>();
            ParallelToolCallsEnabled = parallelToolCallsEnabled;
            ToolChoice = toolChoice;
            Model = model;
            Object = @object;
            _additionalBinaryDataProperties = additionalBinaryDataProperties;
        }

        public IDictionary<string, string> Metadata { get; }

        public float? Temperature { get; }

        public float? TopP { get; }

        internal InternalServiceTier? ServiceTier { get; }

        public string PreviousResponseId { get; }

        public bool? Background { get; }

        public string Instructions { get; }

        public IList<ResponseTool> Tools { get; }

        public string Id { get; }

        public ResponseStatus? Status { get; }

        public DateTimeOffset CreatedAt { get; }

        public ResponseError Error { get; }

        public ResponseTokenUsage Usage { get; }

        internal IDictionary<string, BinaryData> SerializedAdditionalRawData
        {
            get => _additionalBinaryDataProperties;
            set => _additionalBinaryDataProperties = value;
        }
    }
}
