<?php
namespace Sq\Entity\Schema\ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Sq\Entity\Enum;
use Sq\Entity\Schema\Column;
/**
* Plan.
*/
#[ORM\Entity]
#[ORM\Table(name: 'plan')]
class Plan
{
/**
* @var int
*/
#[ORM\Column(name: 'plan_id', type: 'smallint', precision: 0, scale: 0, nullable: false, options: ['unsigned' => true], unique: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $id;
/**
* @var string|null
*/
#[ORM\Column(name: 'plan_name', type: 'string', length: 32, precision: 0, scale: 0, nullable: true, unique: false)]
private $name;
/**
* @var string|null
*/
#[ORM\Column(name: 'plan_type', type: 'string', length: 0, nullable: false, options: ['default' => 'agency'])]
private $type = Column\PlanType::AGENCY;
/**
* @var string|null
*/
#[ORM\Column(name: 'plan_tagline', type: 'string', length: 255, precision: 0, scale: 0, nullable: true, unique: false)]
private $tagline;
/**
* @var string|null
*/
#[ORM\Column(name: 'plan_notes', type: 'text', length: 255, precision: 0, scale: 0, nullable: true, unique: false)]
private $notes;
/**
* @var string|null
*/
#[ORM\Column(name: 'plan_price_monthly_gbp', type: 'decimal', precision: 8, scale: 2, nullable: true, unique: false)]
private $priceMonthlyGbp;
/**
* @var string|null
*/
#[ORM\Column(name: 'plan_price_yearly_gbp', type: 'decimal', precision: 8, scale: 2, nullable: true, unique: false)]
private $priceYearlyGbp;
/**
* @var string|null
*/
#[ORM\Column(name: 'plan_price_monthly_usd', type: 'decimal', precision: 8, scale: 2, nullable: true, unique: false)]
private $priceMonthlyUsd;
/**
* @var string|null
*/
#[ORM\Column(name: 'plan_price_yearly_usd', type: 'decimal', precision: 8, scale: 2, nullable: true, unique: false)]
private $priceYearlyUsd;
/**
* @var string|null
*/
#[ORM\Column(name: 'plan_price_monthly_eur', type: 'decimal', precision: 8, scale: 2, nullable: true, unique: false)]
private $priceMonthlyEur;
/**
* @var string|null
*/
#[ORM\Column(name: 'plan_price_yearly_eur', type: 'decimal', precision: 8, scale: 2, nullable: true, unique: false)]
private $priceYearlyEur;
/**
* @var int|null
*/
#[ORM\Column(name: 'plan_limit_accounts', type: 'smallint', precision: 0, scale: 0, nullable: true, options: ['unsigned' => true], unique: false)]
private $limitAccounts;
/**
* @var int|null
*/
#[ORM\Column(name: 'plan_limit_posts', type: 'smallint', precision: 0, scale: 0, nullable: true, options: ['unsigned' => true], unique: false)]
private $limitPosts;
/**
* @var int|null
*/
#[ORM\Column(name: 'plan_limit_users', type: 'smallint', precision: 0, scale: 0, nullable: true, options: ['unsigned' => true], unique: false)]
private $limitUsers;
/**
* @var int|null
*/
#[ORM\Column(name: 'plan_limit_workspaces', type: 'smallint', precision: 0, scale: 0, nullable: true, options: ['unsigned' => true], unique: false)]
private $limitWorkspaces;
/**
* @var int|null
*/
#[ORM\Column(name: 'plan_limit_timeslots', type: 'smallint', precision: 0, scale: 0, nullable: true, options: ['unsigned' => true], unique: false)]
private $limitTimeslots;
/**
* @var int|null
*/
#[ORM\Column(name: 'plan_limit_categories', type: 'smallint', precision: 0, scale: 0, nullable: true, options: ['unsigned' => true], unique: false)]
private $limitCategories;
/**
* @var int|null
*/
#[ORM\Column(name: 'plan_limit_importer', type: 'smallint', nullable: true, unique: false)]
private $limitImporter;
/**
* @var int|null
*/
#[ORM\Column(name: 'plan_limit_auto_rss', type: 'integer', precision: 0, scale: 0, nullable: true, options: ['default' => '1', 'unsigned' => true], unique: false)]
private $limitAutoRss = '1';
/**
* @var int|null
*/
#[ORM\Column(name: 'plan_limit_analytics', type: 'smallint', nullable: true, unique: false)]
private $limitAnalytics;
/**
* @var int|null
*/
#[ORM\Column(name: 'plan_limit_ai_text', type: 'integer', precision: 0, scale: 0, nullable: false, options: ['default' => '5000', 'unsigned' => true], unique: false)]
private $limitAiText = '5000';
/**
* @var int|null
*/
#[ORM\Column(name: 'plan_limit_weekly_tweet_cap', type: 'integer', precision: 0, scale: 0, nullable: false, options: ['default' => '5', 'unsigned' => true], unique: false)]
private $limitWeeklyTweetCap = '5';
/**
* @var Collection<int, PlanGroup>
*/
#[ORM\OneToMany(targetEntity: PlanGroup::class, mappedBy: 'plan')]
private $planGroups;
public function __construct()
{
$this->planGroups = new ArrayCollection();
}
public function getId()
{
return $this->id;
}
public function getName()
{
return $this->name;
}
public function getType(): Enum\Plan\PlanType
{
$type = match ($this->type)
{
Column\PlanType::SOLO => Enum\Plan\PlanType::SOLO(),
Column\PlanType::BUSINESS => Enum\Plan\PlanType::BUSINESS(),
Column\PlanType::AGENCY => Enum\Plan\PlanType::AGENCY(),
Column\PlanType::LITE => Enum\Plan\PlanType::LITE()
};
$type === null && throw new \RuntimeException('getType() type invalid');
return $type;
}
public function getTagline()
{
return $this->tagline;
}
public function getNotes()
{
return $this->notes;
}
public function getPriceMonthlyGbp(): ?string
{
return $this->priceMonthlyGbp;
}
public function getPriceYearlyGbp(): ?string
{
return $this->priceYearlyGbp;
}
public function getPriceMonthlyUsd(): ?string
{
return $this->priceMonthlyUsd;
}
public function getPriceYearlyUsd(): ?string
{
return $this->priceYearlyUsd;
}
public function getPriceMonthlyEur(): ?string
{
return $this->priceMonthlyEur;
}
public function getPriceYearlyEur(): ?string
{
return $this->priceYearlyEur;
}
/**
* @deprecated - (Not really deprecated, but to mark it).
*
* @use \Sq\Service\Plan\MemberPlanLimits::getPlanLimitAccounts() instead (to include addons).
*/
public function getLimitAccounts()
{
return $this->limitAccounts;
}
/**
* @deprecated - (Not really deprecated, but to mark it).
*
* @use \Sq\Service\Plan\MemberPlanLimits::getPlanLimitPosts() instead (to include addons).
*/
public function getLimitPosts()
{
return $this->limitPosts;
}
/**
* @deprecated - (Not really deprecated, but to mark it).
*
* @use \Sq\Service\Plan\MemberPlanLimits::getPlanLimitUsers() instead (to include addons).
*/
public function getLimitUsers()
{
return $this->limitUsers;
}
/**
* @deprecated - (Not really deprecated, but to mark it).
*
* @use \Sq\Service\Plan\MemberPlanLimits::getPlanLimitWorkspaces() instead (to include addons).
*/
public function getLimitWorkspaces()
{
return $this->limitWorkspaces;
}
/**
* @deprecated - (Not really deprecated, but to mark it).
*
* @use \Sq\Service\Plan\MemberPlanLimits::getPlanLimitTimeslots() instead (to include addons).
*/
public function getLimitTimeslots()
{
return $this->limitTimeslots;
}
/**
* @deprecated - (Not really deprecated, but to mark it).
*
* @use \Sq\Service\Plan\MemberPlanLimits::getPlanLimitCategories() instead (to include addons).
*/
public function getLimitCategories()
{
return $this->limitCategories;
}
/**
* @deprecated - (Not really deprecated, but to mark it).
*
* @use \Sq\Service\Plan\MemberPlanLimits::getPlanLimitImporter() instead (to include addons).
*/
public function getLimitImporter()
{
return $this->limitImporter;
}
/**
* @deprecated - (Not really deprecated, but to mark it).
*
* @use \Sq\Service\Plan\MemberPlanLimits::getPlanLimitAutoRss() instead (to include addons).
*/
public function getLimitAutoRss()
{
return $this->limitAutoRss;
}
/**
* @deprecated - (Not really deprecated, but to mark it).
*
* @use \Sq\Service\Plan\MemberPlanLimits::getPlanLimitAnalytics() instead (to include addons).
*/
public function getLimitAnalytics()
{
return $this->limitAnalytics;
}
/**
* @deprecated - (Not really deprecated, but to mark it).
*
* @use \Sq\Service\Plan\MemberPlanLimits::getPlanLimitAiText() instead (to include addons).
* @use \Sq\Service\Plan\MemberPlanLimits::canGenerateAiText() instead (to include addons).
*/
public function getLimitAiText()
{
return $this->limitAiText;
}
/**
* @deprecated - (Not really deprecated, but to mark it).
*
* @use \Sq\Service\Plan\MemberPlanLimits::getPlanLimitWeeklyTweetCap() instead (to include addons).
*/
public function getLimitWeeklyTweetCap()
{
return $this->limitWeeklyTweetCap;
}
/**
* Get the plan group for this plan.
* Since each plan has exactly one plan group, this returns the first (and only) element.
*
* Will return null for trial plan (no attached group).
*/
public function getPlanGroup(): ?PlanGroup
{
return $this->planGroups->first() ?: null;
}
}