import 'package:freezed_annotation/freezed_annotation.dart'; part 'proxy_host.freezed.dart'; /// NPM proxy host entity representing a domain configuration. @freezed sealed class ProxyHost with _$ProxyHost { const factory ProxyHost({ /// Proxy host ID. required int id, /// Domain names (can have multiple). required List domainNames, /// Forward scheme (http or https). required String forwardScheme, /// Forward host (IP or hostname). required String forwardHost, /// Forward port. required int forwardPort, /// Whether SSL is enabled. required bool sslEnabled, /// SSL certificate ID (if enabled). int? certificateId, /// Whether the host is enabled. @Default(true) bool enabled, /// Whether HTTP/2 is enabled. @Default(false) bool http2Support, /// Whether HSTS is enabled. @Default(false) bool hstsEnabled, /// Whether to force SSL. @Default(false) bool forceSSL, /// Custom locations (advanced nginx config). @Default([]) List locations, /// Access list ID (for auth). int? accessListId, /// Cache assets enabled. @Default(false) bool cacheAssets, /// Block common exploits. @Default(false) bool blockExploits, /// Websocket support. @Default(false) bool websocketSupport, /// Created timestamp. DateTime? createdAt, /// Modified timestamp. DateTime? modifiedAt, }) = _ProxyHost; const ProxyHost._(); /// Primary domain (first in list). String get primaryDomain => domainNames.isNotEmpty ? domainNames.first : 'Unknown'; /// Forward URL (scheme://host:port). String get forwardUrl => '$forwardScheme://$forwardHost:$forwardPort'; /// SSL status label. String get sslStatus => sslEnabled ? 'SSL Enabled' : 'No SSL'; } /// Proxy location for advanced routing. @freezed sealed class ProxyLocation with _$ProxyLocation { const factory ProxyLocation({ /// Location path. required String path, /// Forward scheme. required String forwardScheme, /// Forward host. required String forwardHost, /// Forward port. required int forwardPort, }) = _ProxyLocation; }