<?php
namespace MedBrief\MSR\Entity;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
use MedBrief\MSR\Repository\UserFailedLoginsRepository;
/**
* @ORM\Table(name="UserFailedLogins")
*
* @ORM\Entity(repositoryClass=UserFailedLoginsRepository::class)
*
*/
class UserFailedLogins
{
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
private ?int $id;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $username;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $ipAddress;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $failedCount = null;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private ?DateTimeInterface $firstAttempt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private ?DateTimeInterface $lastAttempt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private ?DateTimeInterface $successfulLoginTimestamp;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $otpFailedCount = null;
/**
* Get the ID of the UserFailedLogins entity.
*
* @return int|null Returns the ID of the UserFailedLogins entity.
*/
public function getId(): ?int
{
return $this->id;
}
/**
* Get the username of the UserFailedLogins entity.
*
* @return string|null Returns the username of the UserFailedLogins entity.
* If the username is not set, it returns null.
*/
public function getUsername(): ?string
{
return $this->username;
}
/**
* Sets the username of the UserFailedLogins entity.
*
* @param string|null $username The username of the UserFailedLogins entity.
* If null, the username will be set to null.
*
* @return self Returns the current instance of the UserFailedLogins entity.
* This allows method chaining.
*/
public function setUsername(?string $username): self
{
if ($username !== null) {
$this->username = $username;
} else {
$this->username = json_encode(['']);
}
return $this;
}
/**
* Get the IP address of the UserFailedLogins entity.
*
* @return string|null Returns the IP address of the UserFailedLogins entity.
* If the IP address is not set, it returns null.
*/
public function getIpAddress(): ?string
{
return $this->ipAddress;
}
/**
* Sets the IP address of the UserFailedLogins entity.
*
* @param string|null $ipAddress The IP address of the UserFailedLogins entity.
* If null, the IP address will be set to null.
*
* @return self Returns the current instance of the UserFailedLogins entity.
* This allows method chaining.
*/
public function setIpAddress(?string $ipAddress): self
{
if ($ipAddress !== null) {
$this->ipAddress = $ipAddress;
} else {
$this->ipAddress = json_encode(['']);
}
return $this;
}
/**
* Get the failed count of the UserFailedLogins entity.
*
* @return int|null Returns the failed count of the UserFailedLogins entity.
* If the failed count is not set, it returns 0.
*/
public function getFailedCount(): ?int
{
if ($this->failedCount === null) {
return 0;
}
return $this->failedCount;
}
/**
* Sets the failed count of the UserFailedLogins entity.
*
* @param int|null $failedCount The failed count of the UserFailedLogins entity.
* If null, the failed count will be set to null.
*
* @return self Returns the current instance of the UserFailedLogins entity.
* This allows method chaining.
*/
public function setFailedCount(?int $failedCount): self
{
$this->failedCount = $failedCount;
return $this;
}
/**
* Gets the first attempt timestamp of the UserFailedLogins entity.
*
* @return DateTimeInterface|null Returns the first attempt timestamp.
* If the first attempt timestamp is not set, it returns null.
*/
public function getFirstAttempt(): ?DateTimeInterface
{
return $this->firstAttempt;
}
/**
* Sets the first attempt timestamp of the UserFailedLogins entity.
*
* @param DateTimeInterface|null $firstAttempt The first attempt timestamp.
* If null, the first attempt timestamp will be set to null.
*
* @return self Returns the current instance of the UserFailedLogins entity.
* This allows method chaining.
*/
public function setFirstAttempt(?DateTimeInterface $firstAttempt): self
{
$this->firstAttempt = $firstAttempt;
return $this;
}
/**
* Gets the last attempt timestamp of the UserFailedLogins entity.
*
* @return DateTimeInterface|null Returns the last attempt timestamp.
* If the last attempt timestamp is not set, it returns null.
*/
public function getLastAttempt(): ?DateTimeInterface
{
return $this->lastAttempt;
}
/**
* Sets the last attempt timestamp of the UserFailedLogins entity.
*
* @param DateTimeInterface|null $lastAttempt The last attempt timestamp.
* If null, the last attempt timestamp will be set to null.
*
* @return self Returns the current instance of the UserFailedLogins entity.
* This allows method chaining.
*/
public function setLastAttempt(?DateTimeInterface $lastAttempt): self
{
$this->lastAttempt = $lastAttempt;
return $this;
}
/**
* Gets the successful login timestamp of the UserFailedLogins entity.
*
* @return \DateTimeInterface|null Returns the successful login timestamp.
* If the successful login timestamp is not set, it returns null.
*/
public function getSuccessfulLoginTimestamp(): ?DateTimeInterface
{
return $this->successfulLoginTimestamp;
}
/**
* Sets the successful login timestamp of the UserFailedLogins entity.
*
* @param \DateTimeInterface|null $successfulLoginTimestamp The successful login timestamp.
* If null, the successful login timestamp will be set to null.
*
* @return self Returns the current instance of the UserFailedLogins entity.
* This allows method chaining.
*/
public function setSuccessfulLoginTimestamp(?DateTimeInterface $successfulLoginTimestamp): self
{
$this->successfulLoginTimestamp = $successfulLoginTimestamp;
return $this;
}
/**
* Gets the OTP failed count of the UserFailedLogins entity.
*
* @return int|null Returns the OTP failed count.
* If the OTP failed count is not set, it returns null.
*/
public function getOtpFailedCount()
{
if ($this->otpFailedCount === null) {
return 0;
}
return $this->otpFailedCount;
}
/**
* Sets the OTP failed count of the UserFailedLogins entity.
*
* @param int|null $otpFailedCount The OTP failed count.
* If null, the OTP failed count will be set to null.
*
* @return self Returns the current instance of the UserFailedLogins entity.
* This allows method chaining.
*/
public function setOtpFailedCount(?int $otpFailedCount)
{
$this->otpFailedCount = $otpFailedCount;
return $this;
}
}