using e_suite.API.Common.repository;
using e_suite.Database.Audit;
using e_suite.Database.Core.Extensions;
using e_suite.Database.Core.Helpers;
using e_suite.Database.Core.Tables.Forms;
using e_suite.UnitTestCore;
using eSuite.Core.Miscellaneous;
using MockQueryable;

namespace e_suite.Modules.SpecificationManager.UnitTests.Helpers;

public class FakeFormRepository : FakeRepository, IFormRepository
{
    public List<FormTemplate> FormTemplates { get; set; } = [];
    public List<FormInstance> FormInstances { get; set; } = [];

    public Task<FormTemplate?> GetTemplateAsync(IGeneralIdRef id, CancellationToken cancellationToken)
    {
        return Task.FromResult(FormTemplates.FindByGeneralIdRef(id));
    }

    public Task<FormTemplate?> GetTemplateWithOutLoadedRefereranceAsync(IGeneralIdRef id, CancellationToken cancellationToken)
    {
        throw new NotImplementedException();
    }

    public Task CreateTemplateAsync(AuditUserDetails auditUserDetails, FormTemplate template, CancellationToken cancellationToken)
    {
        throw new NotImplementedException();
    }

    public IQueryable<FormTemplate> GetTemplates()
    {
        return FormTemplates.BuildMock();
    }

    public Task DeleteAllVersionsAsync(
        AuditUserDetails auditUserDetails,
        IEnumerable<FormTemplateVersion> formTemplateVersions,
        CancellationToken cancellationToken
    )
    {
        throw new NotImplementedException();
    }

    public Task EditFormTemplateAsync(
        AuditUserDetails auditUserDetails,
        FormTemplate formTemplate,
        CancellationToken cancellationToken
    )
    {
        throw new NotImplementedException();
    }

    public Task CreateNewFormVersionAsync(
        AuditUserDetails auditUserDetails,
        FormTemplateVersion formTemplateVersion,
        CancellationToken cancellationToken
    )
    {
        throw new NotImplementedException();
    }

    public IQueryable<FormTemplateVersion> GetAllFormVersions(long templateId)
    {
        throw new NotImplementedException();
    }

    public Task<FormTemplateVersion?> GetFormTemplateVersionAsync(IGeneralIdRef id, CancellationToken cancellationToken)
    {
        throw new NotImplementedException();
    }

    public Task<FormTemplate?> GetFormTemplateWithSpecificVersionAsync(
        IGeneralIdRef id,
        long formTemplateVersionId,
        CancellationToken cancellationToken
    )
    {
        throw new NotImplementedException();
    }

    public Task AddFormInstance(
        AuditUserDetails auditUserDetails,
        FormInstance newFormInstance,
        CancellationToken cancellationToken
    )
    {
        throw new NotImplementedException();
    }

    public Task AddFormInstanceValues(
        AuditUserDetails auditUserDetails,
        List<FormFieldInstance> customFieldValues,
        CancellationToken cancellationToken
    )
    {
        throw new NotImplementedException();
    }

    public Task<FormInstance?> GetFormInstance(GeneralIdRef createFormInstanceId, bool tracking, CancellationToken cancellationToken)
    {
        return Task.FromResult(FormInstances.FindByGeneralIdRef(createFormInstanceId));
    }

    public Task<List<FormInstance>> GetFormInstances(IEnumerable<GeneralIdRef> generalIdRefs, bool tracking, CancellationToken cancellationToken)
    {
        throw new NotImplementedException();
    }

    public Task SaveCustomFieldValues(AuditUserDetails auditUserDetails, Delta<FormFieldInstance> delta, CancellationToken cancellationToken)
    {
        throw new NotImplementedException();
    }

    public Task<IEnumerable<FormInstance>> GetFormsContainingFieldValue(IGeneralIdRef customFieldGeneralIdRef, string value, CancellationToken cancellationToken)
    {
        throw new NotImplementedException();
    }

    public Task AddFormInstances(AuditUserDetails auditUserDetails, IEnumerable<FormInstance> newFormInstance, CancellationToken cancellationToken)
    {
        throw new NotImplementedException();
    }
}