// <auto-generated/>

#nullable disable

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

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

        internal ThreadRun(string id, DateTimeOffset createdAt, string threadId, string assistantId, RunStatus status, RunError lastError, DateTimeOffset? expiresAt, DateTimeOffset? startedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, DateTimeOffset? completedAt, RunIncompleteDetails incompleteDetails, string model, string instructions, RunTokenUsage usage, RunTruncationStrategy truncationStrategy, AssistantResponseFormat responseFormat, ToolConstraint toolConstraint, bool? allowParallelToolCalls, int? maxInputTokenCount, int? maxOutputTokenCount, InternalRunRequiredAction internalRequiredAction)
        {
            Id = id;
            CreatedAt = createdAt;
            ThreadId = threadId;
            AssistantId = assistantId;
            Status = status;
            LastError = lastError;
            ExpiresAt = expiresAt;
            StartedAt = startedAt;
            CancelledAt = cancelledAt;
            FailedAt = failedAt;
            CompletedAt = completedAt;
            IncompleteDetails = incompleteDetails;
            Model = model;
            Instructions = instructions;
            Tools = new ChangeTrackingList<ToolDefinition>();
            Metadata = new ChangeTrackingDictionary<string, string>();
            Usage = usage;
            TruncationStrategy = truncationStrategy;
            ResponseFormat = responseFormat;
            ToolConstraint = toolConstraint;
            AllowParallelToolCalls = allowParallelToolCalls;
            MaxInputTokenCount = maxInputTokenCount;
            MaxOutputTokenCount = maxOutputTokenCount;
            _internalRequiredAction = internalRequiredAction;
        }

        internal ThreadRun(string id, DateTimeOffset createdAt, string threadId, string assistantId, RunStatus status, RunError lastError, DateTimeOffset? expiresAt, DateTimeOffset? startedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, DateTimeOffset? completedAt, RunIncompleteDetails incompleteDetails, string model, string instructions, IReadOnlyList<ToolDefinition> tools, IReadOnlyDictionary<string, string> metadata, RunTokenUsage usage, float? temperature, RunTruncationStrategy truncationStrategy, string @object, AssistantResponseFormat responseFormat, ToolConstraint toolConstraint, float? nucleusSamplingFactor, bool? allowParallelToolCalls, int? maxInputTokenCount, int? maxOutputTokenCount, InternalRunRequiredAction internalRequiredAction, IDictionary<string, BinaryData> additionalBinaryDataProperties)
        {
            // Plugin customization: ensure initialization of collections
            Id = id;
            CreatedAt = createdAt;
            ThreadId = threadId;
            AssistantId = assistantId;
            Status = status;
            LastError = lastError;
            ExpiresAt = expiresAt;
            StartedAt = startedAt;
            CancelledAt = cancelledAt;
            FailedAt = failedAt;
            CompletedAt = completedAt;
            IncompleteDetails = incompleteDetails;
            Model = model;
            Instructions = instructions;
            Tools = tools ?? new ChangeTrackingList<ToolDefinition>();
            Metadata = metadata ?? new ChangeTrackingDictionary<string, string>();
            Usage = usage;
            Temperature = temperature;
            TruncationStrategy = truncationStrategy;
            Object = @object;
            ResponseFormat = responseFormat;
            ToolConstraint = toolConstraint;
            NucleusSamplingFactor = nucleusSamplingFactor;
            AllowParallelToolCalls = allowParallelToolCalls;
            MaxInputTokenCount = maxInputTokenCount;
            MaxOutputTokenCount = maxOutputTokenCount;
            _internalRequiredAction = internalRequiredAction;
            _additionalBinaryDataProperties = additionalBinaryDataProperties;
        }

        public string Id { get; }

        public DateTimeOffset CreatedAt { get; }

        public string ThreadId { get; }

        public string AssistantId { get; }

        public RunStatus Status { get; }

        public RunError LastError { get; }

        public DateTimeOffset? ExpiresAt { get; }

        public DateTimeOffset? StartedAt { get; }

        public DateTimeOffset? CancelledAt { get; }

        public DateTimeOffset? FailedAt { get; }

        public DateTimeOffset? CompletedAt { get; }

        public RunIncompleteDetails IncompleteDetails { get; }

        public string Model { get; }

        public string Instructions { get; }

        public IReadOnlyList<ToolDefinition> Tools { get; }

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

        public RunTokenUsage Usage { get; }

        public float? Temperature { get; }

        public RunTruncationStrategy TruncationStrategy { get; }

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