'boolean', 'daily_limit' => 'integer', 'is_active' => 'boolean', 'options' => 'array', ]; // Options 키 상수 public const OPTION_SMTP = 'smtp'; public const OPTION_PRESET = 'preset'; public const OPTION_BRANDING = 'branding'; public const OPTION_CONNECTION_TEST = 'connection_test'; public function tenant(): BelongsTo { return $this->belongsTo(Tenant::class); } public function getOption(string $key, mixed $default = null): mixed { return data_get($this->options, $key, $default); } public function setOption(string $key, mixed $value): static { $options = $this->options ?? []; data_set($options, $key, $value); $this->options = $options; return $this; } public function getSmtpHost(): ?string { return $this->getOption('smtp.host'); } public function getSmtpPort(): int { return (int) $this->getOption('smtp.port', 587); } public function getSmtpEncryption(): string { return $this->getOption('smtp.encryption', 'tls'); } public function getSmtpUsername(): ?string { return $this->getOption('smtp.username'); } public function getSmtpPassword(): ?string { $encrypted = $this->getOption('smtp.password'); if (! $encrypted) { return null; } try { return decrypt($encrypted); } catch (\Exception $e) { return null; } } public function getPreset(): ?string { return $this->getOption('preset'); } }