- Add comprehensive health check system with multiple endpoints - Add Prometheus metrics endpoint - Add production logging configurations (5 strategies) - Add complete deployment documentation suite: * QUICKSTART.md - 30-minute deployment guide * DEPLOYMENT_CHECKLIST.md - Printable verification checklist * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference * production-logging.md - Logging configuration guide * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation * README.md - Navigation hub * DEPLOYMENT_SUMMARY.md - Executive summary - Add deployment scripts and automation - Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment - Update README with production-ready features All production infrastructure is now complete and ready for deployment.
114 lines
3.0 KiB
PHP
114 lines
3.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Domain\SmartLink\ValueObjects;
|
|
|
|
final readonly class LinkSettings
|
|
{
|
|
public function __construct(
|
|
public bool $trackClicks,
|
|
public bool $enableGeoRouting,
|
|
public bool $showPreview,
|
|
public ?string $customDomain,
|
|
public ?int $clickLimit,
|
|
public ?string $password
|
|
) {
|
|
}
|
|
|
|
public static function default(): self
|
|
{
|
|
return new self(
|
|
trackClicks: true,
|
|
enableGeoRouting: true,
|
|
showPreview: true,
|
|
customDomain: null,
|
|
clickLimit: null,
|
|
password: null
|
|
);
|
|
}
|
|
|
|
public function withClickTracking(bool $enabled): self
|
|
{
|
|
return new self(
|
|
trackClicks: $enabled,
|
|
enableGeoRouting: $this->enableGeoRouting,
|
|
showPreview: $this->showPreview,
|
|
customDomain: $this->customDomain,
|
|
clickLimit: $this->clickLimit,
|
|
password: $this->password
|
|
);
|
|
}
|
|
|
|
public function withGeoRouting(bool $enabled): self
|
|
{
|
|
return new self(
|
|
trackClicks: $this->trackClicks,
|
|
enableGeoRouting: $enabled,
|
|
showPreview: $this->showPreview,
|
|
customDomain: $this->customDomain,
|
|
clickLimit: $this->clickLimit,
|
|
password: $this->password
|
|
);
|
|
}
|
|
|
|
public function withClickLimit(?int $limit): self
|
|
{
|
|
return new self(
|
|
trackClicks: $this->trackClicks,
|
|
enableGeoRouting: $this->enableGeoRouting,
|
|
showPreview: $this->showPreview,
|
|
customDomain: $this->customDomain,
|
|
clickLimit: $limit,
|
|
password: $this->password
|
|
);
|
|
}
|
|
|
|
public function withPassword(?string $password): self
|
|
{
|
|
return new self(
|
|
trackClicks: $this->trackClicks,
|
|
enableGeoRouting: $this->enableGeoRouting,
|
|
showPreview: $this->showPreview,
|
|
customDomain: $this->customDomain,
|
|
clickLimit: $this->clickLimit,
|
|
password: $password ? password_hash($password, PASSWORD_BCRYPT) : null
|
|
);
|
|
}
|
|
|
|
public function isPasswordProtected(): bool
|
|
{
|
|
return $this->password !== null;
|
|
}
|
|
|
|
public function verifyPassword(string $password): bool
|
|
{
|
|
if (! $this->isPasswordProtected()) {
|
|
return true;
|
|
}
|
|
|
|
return password_verify($password, $this->password);
|
|
}
|
|
|
|
public function hasClickLimitReached(int $currentClicks): bool
|
|
{
|
|
if ($this->clickLimit === null) {
|
|
return false;
|
|
}
|
|
|
|
return $currentClicks >= $this->clickLimit;
|
|
}
|
|
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'track_clicks' => $this->trackClicks,
|
|
'enable_geo_routing' => $this->enableGeoRouting,
|
|
'show_preview' => $this->showPreview,
|
|
'custom_domain' => $this->customDomain,
|
|
'click_limit' => $this->clickLimit,
|
|
'has_password' => $this->isPasswordProtected(),
|
|
];
|
|
}
|
|
}
|