using DD.Persistence.Database.Model;
using DD.Persistence.Models;
using Xunit;

namespace DD.Persistence.IntegrationTests.Controllers;
public class DataSaubControllerTest : TimeSeriesBaseControllerTest<DataSaub, DataSaubDto>
{
    private readonly DataSaubDto dto = new()
    {
        AxialLoad = 1,
        BitDepth = 2,
        BlockPosition = 3,
        BlockSpeed = 4,
        Date = DateTimeOffset.UtcNow,
        Flow = 5,
        HookWeight = 6,
        IdFeedRegulator = 8,
        Mode = 9,
        Mse = 10,
        MseState = 11,
        Pressure = 12,
        Pump0Flow = 13,
        Pump1Flow = 14,
        Pump2Flow = 15,
        RotorSpeed = 16,
        RotorTorque = 17,
        User = string.Empty,
        WellDepth = 18,
    };

    private readonly DataSaub entity = new()
    {
        AxialLoad = 1,
        BitDepth = 2,
        BlockPosition = 3,
        BlockSpeed = 4,
        Timestamp = DateTimeOffset.UtcNow,
        Flow = 5,
        HookWeight = 6,
        IdFeedRegulator = 8,
        Mode = 9,
        Mse = 10,
        MseState = 11,
        Pressure = 12,
        Pump0Flow = 13,
        Pump1Flow = 14,
        Pump2Flow = 15,
        RotorSpeed = 16,
        RotorTorque = 17,
        User = string.Empty,
        WellDepth = 18,
    };

    public DataSaubControllerTest(WebAppFactoryFixture factory) : base(factory)
    {
    }

    [Fact]
    public async Task InsertRange_returns_success()
    {
        await InsertRangeSuccess(dto);
    }

    [Fact]
    public async Task Get_returns_success()
    {
        var beginDate = DateTimeOffset.UtcNow.AddDays(-1);
        var endDate = DateTimeOffset.UtcNow;
        await GetSuccess(beginDate, endDate, entity);
    }

    [Fact]
    public async Task GetDatesRange_returns_success()
    {
        await GetDatesRangeSuccess(entity);
    }



    [Fact]
    public async Task GetResampledData_returns_success()
    {
        await GetResampledDataSuccess(entity);
    }
}