ebs/src/Enum/OfferType.php
Sarahshr b9a87a420b
Feat/disable services option for groups (#711)
* add servicesDisabled field for groups and for global configuration

* fixup! add servicesDisabled field for groups and for global configuration

* comment libcurl upgrade to fix ci temporarly

* upgrade caddy version

* review

* fix test

* feat: add paying membership option (#714)

* feat: add paying membership option

* fix: ci

* fix: phpstan + review

* fix: eslint ci
2024-10-08 09:40:23 +02:00

48 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Enum;
enum OfferType: string
{
use AsArrayTrait;
// The user only to pay once to access the group/platform. In his case the end date is
// not set and the membership is valid until it is deleted or a end date is
// set. The end date can always be set manually in case of a problem.
case ONESHOT = 'oneshot';
// Monthly subscription. The membership is valid 1 month and the user has to
// renew it once the end date is over. This can be useful when a user when to
// try a group/platform on the short period before taking a longer subscription.
case MONTHLY = 'monthly';
// Subscription valid for one year. An email will be send a few days before
// the end of the membership
case YEARLY = 'yearly';
public function isMonthly(): bool
{
return $this === self::MONTHLY;
}
public function isYearly(): bool
{
return $this === self::YEARLY;
}
public function isRecurring(): bool
{
return $this->isYearly() || $this->isMonthly();
}
public function getEndAtInterval(): string
{
return match ($this) {
self::YEARLY => '+1 year midnight',
self::MONTHLY => '+1 month midnight',
self::ONESHOT => '',
};
}
}