<?php
namespace App\AppBundle\AdminBundle\Entity;
use App\AppBundle\MainBundle\Entity\User;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use JsonSerializable;
/**
* AddOns
*
* @ORM\Entity
* @ORM\Table(name="admin_notifications")
* @ORM\HasLifecycleCallbacks()
*/
class AdminNotifications implements JsonSerializable
{
const
TYPE_NEW_USER_REGISTERED = 'new_user_registered',//Done
TYPE_NEW_VERIFY_SPOT_REQUEST = 'new_verify_spot_request',//Done
TYPE_NEW_SPOT_CREATED = 'new_spot_created',//Done
TYPE_NEW_BOOKING_HOURLY = 'new_booking_hourly',//Done
TYPE_NEW_BOOKING_FLEXIBLE = 'new_booking_flexible',//Done
TYPE_NEW_BOOKING_MONTHLY = 'new_booking_monthly',//Done
TYPE_CANCEL_BOOKING_HOURLY = 'cancel_booking_hourly',//Done
TYPE_CANCEL_BOOKING_FLEXIBLE = 'cancel_booking_flexible',//Done
TYPE_CANCEL_BOOKING_MONTHLY = 'cancel_booking_monthly',//Done
TYPE_SPOT_ACTIVATED = 'spot_activated',//Done
TYPE_SPOT_DEACTIVATED = 'spot_deactivated',//Done
TYPE_SPOT_DELETED = 'spot_deleted',//Done
TYPE_INCOMPLETE_SPOT_DELETED = 'incomplete_spot_deleted',//Done
TYPE_PAYOUT_PROCESSED = 'payout_processed',
TYPE_PAYOUT_REQUESTED = 'payout_requested',
TYPE_HELP_BUG_REPORTED = 'help_bug_reported',//Done
TYPE_HELP_NEW_IDEA_REPORTED = 'help_new_idea_reported',//Done
TYPE_HELP_CALL_BACK_REQUESTED = 'help_call_back_requested',//Done
TYPE_HELP_MESSAGE_RECEIVED = 'help_message_received',//Done
TYPE_OTHER = 'other';
const TITLE = [
self::TYPE_NEW_USER_REGISTERED => 'admin.notification.title.new.user.registered',
self::TYPE_NEW_VERIFY_SPOT_REQUEST => 'admin.notification.title.new.verify.spot.request',
self::TYPE_NEW_SPOT_CREATED => 'admin.notification.title.new.spot.created',
self::TYPE_NEW_BOOKING_HOURLY => 'admin.notification.title.new.booking.hourly',
self::TYPE_NEW_BOOKING_FLEXIBLE => 'admin.notification.title.new.booking.flexible',
self::TYPE_NEW_BOOKING_MONTHLY => 'admin.notification.title.new.booking.monthly',
self::TYPE_CANCEL_BOOKING_HOURLY => 'admin.notification.title.cancel.booking.hourly',
self::TYPE_CANCEL_BOOKING_FLEXIBLE => 'admin.notification.title.cancel.booking.flexible',
self::TYPE_CANCEL_BOOKING_MONTHLY =>'admin.notification.title.cancel.booking.monthly',
self::TYPE_SPOT_ACTIVATED => 'admin.notification.title.spot.activated',
self::TYPE_SPOT_DEACTIVATED => 'admin.notification.title.spot.deactivated',
self::TYPE_SPOT_DELETED => 'admin.notification.title.spot.deleted',
self::TYPE_INCOMPLETE_SPOT_DELETED => 'admin.notification.title.incomplete.spot.deleted',
self::TYPE_PAYOUT_PROCESSED => 'admin.notification.title.payout.processed',
self::TYPE_PAYOUT_REQUESTED => 'admin.notification.title.payout.requested',
self::TYPE_HELP_BUG_REPORTED => 'admin.notification.title.help.bug.reported',
self::TYPE_HELP_NEW_IDEA_REPORTED => 'admin.notification.title.help.new.idea.reported',
self::TYPE_HELP_CALL_BACK_REQUESTED => 'admin.notification.title.help.call.back.requested',
self::TYPE_HELP_MESSAGE_RECEIVED => 'admin.notification.title.help.message.received',
self::TYPE_OTHER => 'admin.notification.title.other'
];
const MESSAGE = [
self::TYPE_NEW_USER_REGISTERED => 'admin.notification.message.new.user.registered',
self::TYPE_NEW_VERIFY_SPOT_REQUEST => 'admin.notification.message.new.verify.spot.request',
self::TYPE_NEW_SPOT_CREATED => 'admin.notification.message.new.spot.created',
self::TYPE_NEW_BOOKING_HOURLY => 'admin.notification.message.new.booking.hourly',
self::TYPE_NEW_BOOKING_FLEXIBLE => 'admin.notification.message.new.booking.flexible',
self::TYPE_NEW_BOOKING_MONTHLY => 'admin.notification.message.new.booking.monthly',
self::TYPE_CANCEL_BOOKING_HOURLY => 'admin.notification.message.cancel.booking.hourly',
self::TYPE_CANCEL_BOOKING_FLEXIBLE => 'admin.notification.message.cancel.booking.flexible',
self::TYPE_CANCEL_BOOKING_MONTHLY =>'admin.notification.message.cancel.booking.monthly',
self::TYPE_SPOT_ACTIVATED => 'admin.notification.message.spot.activated',
self::TYPE_SPOT_DEACTIVATED => 'admin.notification.message.spot.deactivated',
self::TYPE_SPOT_DELETED => 'admin.notification.message.spot.deleted',
self::TYPE_INCOMPLETE_SPOT_DELETED => 'admin.notification.message.incomplete.spot.deleted',
self::TYPE_PAYOUT_PROCESSED => 'admin.notification.message.payout.processed',
self::TYPE_PAYOUT_REQUESTED => 'admin.notification.message.payout.requested',
self::TYPE_HELP_BUG_REPORTED => 'admin.notification.message.help.bug.reported',
self::TYPE_HELP_NEW_IDEA_REPORTED => 'admin.notification.message.help.new.idea.reported',
self::TYPE_HELP_CALL_BACK_REQUESTED => 'admin.notification.message.help.call.back.requested',
self::TYPE_HELP_MESSAGE_RECEIVED => 'admin.notification.message.help.message.received',
self::TYPE_OTHER => 'admin.notification.message.other'
];
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var User
* @ORM\ManyToOne(targetEntity="App\AppBundle\MainBundle\Entity\User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
private $user;
/**
* @var string
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $type;
/**
* @var string
* @ORM\Column(type="string", nullable=true, length=1024)
* @Assert\NotBlank()
*/
private $image;
/**
* @var string
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $title;
/**
* @var string
* @ORM\Column(type="string", nullable=false, length=1024)
* @Assert\NotBlank()
*/
private $message;
/**
* @var string
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $payload;
/**
* @var boolean
* @ORM\Column(type="boolean", nullable=false)
* @Assert\NotBlank()
*/
private $seen = 0;
/**
* @var boolean
* @ORM\Column(type="boolean", nullable=false)
* @Assert\NotBlank()
*/
private $active = 1;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return User
*/
public function getUser()
{
return $this->user;
}
/**
* @param User $user
*/
public function setUser(User $user)
{
$this->user = $user;
}
/**
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* @param string $type
*/
public function setType(string $type)
{
$this->type = $type;
}
/**
* @return string
*/
public function getImage()
{
return $this->image;
}
/**
* @param string $image
*/
public function setImage(string $image)
{
$this->image = $image;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @param string $title
*/
public function setTitle(string $title)
{
$this->title = $title;
}
/**
* @return string
*/
public function getMessage()
{
return $this->message;
}
/**
* @param string $message
*/
public function setMessage(string $message)
{
$this->message = $message;
}
/**
* @return string
*/
public function getPayload()
{
return $this->payload;
}
/**
* @param array $payload
* @return string
*/
public function setPayload($payload)
{
$this->payload = json_encode($payload);
return $this;
}
/**
* @return bool
*/
public function isSeen()
{
return $this->seen;
}
/**
* @param bool $seen
*/
public function setSeen(bool $seen)
{
$this->seen = $seen;
}
/**
* @return bool
*/
public function isActive()
{
return $this->active;
}
/**
* @param bool $active
*/
public function setActive(bool $active)
{
$this->active = $active;
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'user' => $this->user,
'active' => $this->active,
'image' => $this->image,
'title' => $this->title,
'type' => $this->type,
'message' => $this->message,
'seen' => $this->seen,
'payload' => $this->payload,
'createdAt' => $this->createdAt->format('Y-m-d H:i:s'),
'updatedAt' => $this->updatedAt->format('Y-m-d H:i:s'),
);
}
/**
* @var DateTime $created
*
* @ORM\Column(type="datetime", nullable=false)
*/
protected $createdAt;
/**
* @var DateTime $updated
*
* @ORM\Column(type="datetime", nullable=false)
*/
protected $updatedAt;
/**
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @return DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @ORM\PrePersist
*/
public function setCreatedAt()
{
$this->createdAt = new DateTime();
$this->updatedAt = new DateTime();
return $this;
}
/**
* @ORM\PreUpdate
*/
public function setUpdatedAtValue() {
$this->updatedAt = new DateTime();
}
public function __construct() {
}
}