using System;
using Npgsql.Internal.TypeHandlers.NumericHandlers;
using Npgsql.Internal.TypeHandling;
using Npgsql.PostgresTypes;
using Npgsql.TypeMapping;
using NpgsqlTypes;

namespace Npgsql.Internal.TypeHandlers.InternalTypeHandlers;

/// <summary>
/// An OIDVector is simply a regular array of uints, with the sole exception that its lower bound must
/// be 0 (we send 1 for regular arrays).
/// </summary>
class OIDVectorHandler : ArrayHandler<uint>
{
    public OIDVectorHandler(PostgresType oidvectorType, PostgresType oidType)
        : base(oidvectorType, new UInt32Handler(oidType), ArrayNullabilityMode.Never, 0) { }

    public override NpgsqlTypeHandler CreateArrayHandler(PostgresArrayType pgArrayType, ArrayNullabilityMode arrayNullabilityMode)
        => new ArrayHandler<ArrayHandler<uint>>(pgArrayType, this, arrayNullabilityMode);
}