<?php
namespace Sq\Entity\Schema\ORM;
use Doctrine\ORM\Mapping as ORM;
use Sq\Entity\Schema\Column;
/**
* SocialNetwork.
*/
#[ORM\Entity]
#[ORM\DiscriminatorColumn(name: 'sn_network', type: 'string')]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorMap([Column\SocialNetworkNetwork::FACEBOOK => FacebookSocialProfile::class, Column\SocialNetworkNetwork::GENERIC_PROFILE => GenericSocialProfile::class, Column\SocialNetworkNetwork::GOOGLE => GoogleSocialProfile::class, Column\SocialNetworkNetwork::INSTAGRAM => InstagramSocialProfile::class, Column\SocialNetworkNetwork::LINKEDIN => LinkedInSocialProfile::class, Column\SocialNetworkNetwork::PINTEREST => PinterestSocialProfile::class, Column\SocialNetworkNetwork::THREADS => ThreadsSocialProfile::class, Column\SocialNetworkNetwork::TIKTOK => TikTokSocialProfile::class, Column\SocialNetworkNetwork::TWITTER => TwitterSocialProfile::class, Column\SocialNetworkNetwork::YOUTUBE => YouTubeSocialProfile::class, 'NULL' => SocialProfile::class])]
#[ORM\Table(name: 'social_network')]
#[ORM\Index(name: 'sn_m_id', columns: ['sn_m_id'])]
#[ORM\UniqueConstraint(name: 'account_id__network', columns: ['sn_account_id', 'sn_network'])]
abstract class SocialNetwork implements OnboardingContentInterface
{
/**
* @var int
*/
#[ORM\Column(name: 'sn_id', type: 'integer', nullable: false, options: ['unsigned' => true])]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
protected $id;
/**
* @var int | null
*/
#[ORM\Column(name: 'sn_account_id', type: 'integer', nullable: true, options: ['unsigned' => true])]
protected $accountId;
/**
* @var Member|null
*/
#[ORM\ManyToOne(targetEntity: Member::class, inversedBy: 'socialProfiles')]
#[ORM\JoinColumn(name: 'sn_m_id', referencedColumnName: 'm_id', nullable: true)]
protected $member;
/**
*
* @var Workspace|null
*/
#[ORM\ManyToOne(targetEntity: Workspace::class, inversedBy: 'socialProfiles')]
#[ORM\JoinColumn(name: 'sn_ws_id', referencedColumnName: 'ws_id', nullable: true)]
protected $workspace;
/**
* @var string|null
*/
#[ORM\Column(name: 'sn_status', type: 'string', length: 0, nullable: true, options: ['default' => 'active'])]
protected $status = Column\SocialNetworkStatus::ACTIVE;
/**
* @var bool|null
*/
#[ORM\Column(name: 'sn_smart_schedule', type: 'boolean', nullable: true)]
protected $smartSchedule = '0';
/**
* @var bool
*/
#[ORM\Column(name: 'sn_onboarding_content', type: 'boolean', nullable: false)]
protected $onboardingContent = false;
/**
* @var \DateTimeInterface|null
*/
#[ORM\Column(name: 'sn_stats_blocked_until', type: 'datetime', nullable: true)]
protected $statsBlockedUntil;
/**
* @var bool|null
*/
#[ORM\Column(name: 'sn_inbox_enabled', type: 'boolean', nullable: true)]
protected $inboxEnabled = false;
/**
* @var \DateTimeInterface|null
*/
#[ORM\Column(name: 'sn_inbox_removed_date', type: 'datetime', nullable: true)]
protected $inboxRemovedDate;
/**
* @var \DateTimeInterface|null
*/
#[ORM\Column(name: 'sn_date_added', type: 'datetime', nullable: true)]
protected $dateAdded;
/**
* @var \DateTimeInterface|null
*/
#[ORM\Column(name: 'sn_date_deleted', type: 'datetime', nullable: true)]
protected $dateDeleted;
#[ORM\OneToMany(targetEntity: QueueMetadata::class, mappedBy: 'socialProfile', cascade: ['remove'], fetch: 'EXTRA_LAZY')]
protected $queueMetadatas;
/**
* @var CustomBitly|null
*/
#[ORM\OneToOne(targetEntity: CustomBitly::class, mappedBy: 'socialProfile')]
protected $customBitly;
#[ORM\OneToOne(targetEntity: Facebook::class, mappedBy: 'socialProfile', fetch: 'EAGER', cascade: ['persist'])]
protected $facebook;
#[ORM\OneToOne(targetEntity: GenericProfile::class, mappedBy: 'socialProfile', fetch: 'EAGER', cascade: ['persist'])]
protected $genericProfile;
#[ORM\OneToOne(targetEntity: Google::class, mappedBy: 'socialProfile', fetch: 'EAGER', cascade: ['persist'])]
protected $google;
#[ORM\OneToOne(targetEntity: Instagram::class, mappedBy: 'socialProfile', fetch: 'EAGER', cascade: ['persist'])]
protected $instagram;
#[ORM\OneToOne(targetEntity: LinkedIn::class, mappedBy: 'socialProfile', fetch: 'EAGER', cascade: ['persist'])]
protected $linkedin;
#[ORM\OneToOne(targetEntity: Pinterest::class, mappedBy: 'socialProfile', fetch: 'EAGER', cascade: ['persist'])]
protected $pinterest;
#[ORM\OneToOne(targetEntity: Threads::class, mappedBy: 'socialProfile', fetch: 'EAGER', cascade: ['persist'])]
protected $threads;
#[ORM\OneToOne(targetEntity: TikTok::class, mappedBy: 'socialProfile', fetch: 'EAGER', cascade: ['persist'])]
protected $tiktok;
#[ORM\OneToOne(targetEntity: Twitter::class, mappedBy: 'socialProfile', fetch: 'EAGER', cascade: ['persist'])]
protected $twitter;
#[ORM\OneToOne(targetEntity: YouTube::class, mappedBy: 'socialProfile', fetch: 'EAGER', cascade: ['persist'])]
protected $youtube;
public function __construct(?Member $member, ?Workspace $workspace = null, bool $isOnboardingContent = false)
{
$this->member = $member;
$this->workspace = $workspace;
$this->dateAdded = new \DateTimeImmutable;
$this->onboardingContent = $isOnboardingContent;
if ($this->workspace !== null)
{
$this->workspace->addSocialProfile($this);
}
}
public function getId(): ?int
{
return $this->id;
}
public function setAccountId(int $accountId): self
{
$this->accountId = $accountId;
return $this;
}
abstract public function getAccountId(): ?int;
public function getMember(): ?Member
{
return $this->member;
}
public function getWorkspace(): Workspace
{
return $this->workspace;
}
public function setWorkspace(?Workspace $workspace): self
{
$this->workspace = $workspace;
return $this;
}
public function isLegacyWithoutWorkspace(): bool
{
return $this->workspace === null;
}
abstract public function getNetwork(): ?string;
public function getStatus(): ?string
{
return $this->status;
}
public function isDeleted(): bool
{
return $this->status === Column\SocialNetworkStatus::DELETED;
}
public function getSmartSchedule(): ?bool
{
return $this->smartSchedule;
}
public function setSmartSchedule(?bool $smartSchedule): self
{
$this->smartSchedule = $smartSchedule;
return $this;
}
public function getStatsBlockedUntil(): ?\DateTimeInterface
{
return $this->statsBlockedUntil;
}
public function setStatsBlockedUntil(?\DateTimeInterface $statsBlockedUntil): self
{
$this->statsBlockedUntil = $statsBlockedUntil;
return $this;
}
public function getInboxEnabled(): ?bool
{
return $this->inboxEnabled;
}
public function setInboxEnabled(?bool $inboxEnabled): self
{
$this->inboxEnabled = $inboxEnabled;
return $this;
}
public function getInboxRemovedDate(): ?\DateTimeInterface
{
return $this->inboxRemovedDate;
}
public function setInboxRemovedDate(?\DateTimeInterface $inboxRemovedDate): self
{
$this->inboxRemovedDate = $inboxRemovedDate;
return $this;
}
public function getDateAdded(): ?\DateTimeInterface
{
return $this->dateAdded;
}
public function setDateAdded(?\DateTimeInterface $dateAdded): SocialNetwork
{
$this->dateAdded = $dateAdded;
return $this;
}
public function getDateDeleted(): ?\DateTimeInterface
{
return $this->dateDeleted;
}
public function setDateDeleted(?\DateTimeInterface $dateDeleted): SocialNetwork
{
$this->dateDeleted = $dateDeleted;
return $this;
}
public function getCustomBitly(): ?CustomBitly
{
return $this->customBitly;
}
public function setCustomBitly(?CustomBitly $customBitly): self
{
$this->customBitly = $customBitly;
return $this;
}
public function isOnboardingContent(): bool
{
return $this->onboardingContent;
}
}