2024-03-28 08:46:12 -04:00
|
|
|
|
using Bit.Core.Billing.Entities;
|
2024-06-14 15:34:47 -04:00
|
|
|
|
using Bit.Core.Billing.Enums;
|
2024-03-28 08:46:12 -04:00
|
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Billing.Models;
|
|
|
|
|
|
|
2024-04-16 13:55:00 -04:00
|
|
|
|
public record ConfiguredProviderPlanDTO(
|
2024-03-28 08:46:12 -04:00
|
|
|
|
Guid Id,
|
|
|
|
|
|
Guid ProviderId,
|
|
|
|
|
|
PlanType PlanType,
|
|
|
|
|
|
int SeatMinimum,
|
2024-03-29 11:18:10 -04:00
|
|
|
|
int PurchasedSeats,
|
|
|
|
|
|
int AssignedSeats)
|
2024-03-28 08:46:12 -04:00
|
|
|
|
{
|
2024-04-16 13:55:00 -04:00
|
|
|
|
public static ConfiguredProviderPlanDTO From(ProviderPlan providerPlan) =>
|
2024-03-29 11:18:10 -04:00
|
|
|
|
providerPlan.IsConfigured()
|
2024-04-16 13:55:00 -04:00
|
|
|
|
? new ConfiguredProviderPlanDTO(
|
2024-03-28 08:46:12 -04:00
|
|
|
|
providerPlan.Id,
|
|
|
|
|
|
providerPlan.ProviderId,
|
|
|
|
|
|
providerPlan.PlanType,
|
|
|
|
|
|
providerPlan.SeatMinimum.GetValueOrDefault(0),
|
2024-03-29 11:18:10 -04:00
|
|
|
|
providerPlan.PurchasedSeats.GetValueOrDefault(0),
|
|
|
|
|
|
providerPlan.AllocatedSeats.GetValueOrDefault(0))
|
2024-03-28 08:46:12 -04:00
|
|
|
|
: null;
|
|
|
|
|
|
}
|