2021-12-14 15:05:07 +00:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
using Bit.Core.Enums;
|
2019-03-21 21:36:03 -04:00
|
|
|
|
using Bit.Core.Models.Business;
|
2017-04-10 11:49:53 -04:00
|
|
|
|
|
2023-10-19 01:27:56 +10:00
|
|
|
|
namespace Bit.Api.AdminConsole.Models.Request.Organizations;
|
2022-08-29 16:06:55 -04:00
|
|
|
|
|
2021-12-14 15:05:07 +00:00
|
|
|
|
public class OrganizationUpgradeRequestModel
|
2017-04-10 11:49:53 -04:00
|
|
|
|
{
|
2019-03-21 21:36:03 -04:00
|
|
|
|
[StringLength(50)]
|
2021-05-06 14:53:12 -05:00
|
|
|
|
public string BusinessName { get; set; }
|
2017-04-10 11:49:53 -04:00
|
|
|
|
public PlanType PlanType { get; set; }
|
2021-05-06 14:53:12 -05:00
|
|
|
|
[Range(0, int.MaxValue)]
|
2021-05-17 09:43:02 -05:00
|
|
|
|
public int AdditionalSeats { get; set; }
|
2019-03-21 21:36:03 -04:00
|
|
|
|
[Range(0, 99)]
|
|
|
|
|
|
public short? AdditionalStorageGb { get; set; }
|
2023-07-24 23:05:05 +01:00
|
|
|
|
[Range(0, int.MaxValue)]
|
|
|
|
|
|
public int? AdditionalSmSeats { get; set; }
|
|
|
|
|
|
[Range(0, int.MaxValue)]
|
|
|
|
|
|
public int? AdditionalServiceAccounts { get; set; }
|
|
|
|
|
|
[Required]
|
|
|
|
|
|
public bool UseSecretsManager { get; set; }
|
2019-03-21 21:36:03 -04:00
|
|
|
|
public bool PremiumAccessAddon { get; set; }
|
2020-12-04 12:05:16 -05:00
|
|
|
|
public string BillingAddressCountry { get; set; }
|
|
|
|
|
|
public string BillingAddressPostalCode { get; set; }
|
2021-05-06 14:53:12 -05:00
|
|
|
|
public OrganizationKeysRequestModel Keys { get; set; }
|
2022-08-29 15:53:48 -04:00
|
|
|
|
|
2021-05-06 14:53:12 -05:00
|
|
|
|
public OrganizationUpgrade ToOrganizationUpgrade()
|
2022-08-29 16:06:55 -04:00
|
|
|
|
{
|
2021-05-06 14:53:12 -05:00
|
|
|
|
var orgUpgrade = new OrganizationUpgrade
|
2019-03-21 21:36:03 -04:00
|
|
|
|
{
|
2021-05-06 14:53:12 -05:00
|
|
|
|
AdditionalSeats = AdditionalSeats,
|
|
|
|
|
|
AdditionalStorageGb = AdditionalStorageGb.GetValueOrDefault(),
|
2023-07-24 23:05:05 +01:00
|
|
|
|
AdditionalServiceAccounts = AdditionalServiceAccounts.GetValueOrDefault(0),
|
|
|
|
|
|
AdditionalSmSeats = AdditionalSmSeats.GetValueOrDefault(0),
|
|
|
|
|
|
UseSecretsManager = UseSecretsManager,
|
2021-05-06 14:53:12 -05:00
|
|
|
|
BusinessName = BusinessName,
|
|
|
|
|
|
Plan = PlanType,
|
2020-12-04 12:05:16 -05:00
|
|
|
|
PremiumAccessAddon = PremiumAccessAddon,
|
2021-05-06 14:53:12 -05:00
|
|
|
|
TaxInfo = new TaxInfo()
|
2019-03-21 21:36:03 -04:00
|
|
|
|
{
|
2020-12-04 12:05:16 -05:00
|
|
|
|
BillingAddressCountry = BillingAddressCountry,
|
|
|
|
|
|
BillingAddressPostalCode = BillingAddressPostalCode
|
|
|
|
|
|
}
|
2019-03-21 21:36:03 -04:00
|
|
|
|
};
|
2021-05-06 14:53:12 -05:00
|
|
|
|
|
2021-06-22 15:14:26 -05:00
|
|
|
|
Keys?.ToOrganizationUpgrade(orgUpgrade);
|
2021-05-06 14:53:12 -05:00
|
|
|
|
|
|
|
|
|
|
return orgUpgrade;
|
2017-04-10 11:49:53 -04:00
|
|
|
|
}
|
|
|
|
|
|
}
|