using e_suite.Database.Core.Models;
using eSuite.Core.Miscellaneous;

namespace e_suite.Database.Core.Extensions;

public static class GeneralIdRefExtensions
{
    public static GeneralIdRef? ToGeneralIdRef(this IGeneralId? generalId)
    {
        if (generalId == null)
            return null;

        return new GeneralIdRef
        {
            Id = generalId.Id,
            Guid = generalId.Guid
        };
    }

    public static IEnumerable<GeneralIdRef> ToGeneralIfRefs(this IEnumerable<IGeneralId> generalIds)
    {
        return generalIds.Select(generalId => new GeneralIdRef
        {
            Id = generalId.Id,
            Guid = generalId.Guid
        });
    }
}