<?php
namespace App\Entity\Bus;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
/**
* Groups one or more BookingSeat rows created together as a single booking.
*
* Added as part of removing the Firestore-based pending-booking flow from the
* imani_bus_app frontend: previously "a booking" (seats selected together,
* paid for together, held before payment succeeds) only existed as a Firestore
* document. This entity is the backend replacement for that concept.
*
* @ORM\Entity(repositoryClass="App\Repository\Bus\BookingRepository")
* @ORM\Table(name="bus_booking")
*/
class Booking
{
/**
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/**
* Short, human-friendly reference shown to the passenger and used as the
* M-Pesa transaction's ref_number for traceability.
*
* @ORM\Column(type="string", length=10, unique=true)
*/
private $shortId;
/**
* @var Trip
* @Serializer\Type("App\Entity\Bus\Trip")
* @ORM\ManyToOne(targetEntity="App\Entity\Bus\Trip")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="trip_id", referencedColumnName="id", nullable=false)
* })
*/
private $trip;
/**
* @var Stop
* @Serializer\Type("App\Entity\Bus\Stop")
* @ORM\ManyToOne(targetEntity="App\Entity\Bus\Stop")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="origin_stop_id", referencedColumnName="id", nullable=false)
* })
*/
private $originStop;
/**
* @var Stop
* @Serializer\Type("App\Entity\Bus\Stop")
* @ORM\ManyToOne(targetEntity="App\Entity\Bus\Stop")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="destination_stop_id", referencedColumnName="id", nullable=false)
* })
*/
private $destinationStop;
/**
* Snapshot of the trip's travel date at booking time.
*
* @ORM\Column(type="datetime")
*/
private $date;
/**
* @ORM\Column(type="integer")
*/
private $totalPrice;
/**
* One of: pending, confirmed, failed.
*
* @ORM\Column(type="string", length=20)
*/
private $status;
/**
* Device identifier sent by the app (Android WebView). Nullable because
* historical/counter-originated bookings will never have one — only
* bookings created through the online flow set this.
*
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $deviceId;
/**
* Payer's phone number. Not known at booking-creation time (the app
* collects it later, at checkout, immediately before the STK push) —
* populated once the M-Pesa callback provides it. May stay null for a
* booking that fails before Safaricom returns any callback metadata.
*
* @ORM\Column(type="string", length=20, nullable=true)
*/
private $phone;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
public function getId()
{
return $this->id;
}
public function setId($id): void
{
$this->id = $id;
}
public function getShortId()
{
return $this->shortId;
}
public function setShortId($shortId): void
{
$this->shortId = $shortId;
}
public function getTrip(): Trip
{
return $this->trip;
}
public function setTrip(Trip $trip): void
{
$this->trip = $trip;
}
public function getOriginStop(): Stop
{
return $this->originStop;
}
public function setOriginStop(Stop $originStop): void
{
$this->originStop = $originStop;
}
public function getDestinationStop(): Stop
{
return $this->destinationStop;
}
public function setDestinationStop(Stop $destinationStop): void
{
$this->destinationStop = $destinationStop;
}
public function getDate()
{
return $this->date;
}
public function setDate($date): void
{
$this->date = $date;
}
public function getTotalPrice()
{
return $this->totalPrice;
}
public function setTotalPrice($totalPrice): void
{
$this->totalPrice = $totalPrice;
}
public function getStatus()
{
return $this->status;
}
public function setStatus($status): void
{
$this->status = $status;
}
public function getDeviceId()
{
return $this->deviceId;
}
public function setDeviceId($deviceId): void
{
$this->deviceId = $deviceId;
}
public function getPhone()
{
return $this->phone;
}
public function setPhone($phone): void
{
$this->phone = $phone;
}
public function getCreatedAt()
{
return $this->createdAt;
}
public function setCreatedAt($createdAt): void
{
$this->createdAt = $createdAt;
}
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function setUpdatedAt($updatedAt): void
{
$this->updatedAt = $updatedAt;
}
}