using Cleanuparr.Domain.Enums;
using Cleanuparr.Domain.Exceptions;
namespace Cleanuparr.Application.Features.DownloadClient.Dtos;
///
/// DTO for creating a new download client (without ID)
///
public sealed record CreateDownloadClientDto
{
///
/// Whether this client is enabled
///
public bool Enabled { get; init; } = false;
///
/// Friendly name for this client
///
public required string Name { get; init; }
///
/// Type name of download client
///
public required DownloadClientTypeName TypeName { get; init; }
///
/// Type of download client
///
public required DownloadClientType Type { get; init; }
///
/// Host address for the download client
///
public Uri? Host { get; init; }
///
/// Username for authentication
///
public string? Username { get; init; }
///
/// Password for authentication
///
public string? Password { get; init; }
///
/// The base URL path component, used by clients like Transmission and Deluge
///
public string? UrlBase { get; init; }
///
/// Validates the configuration
///
public void Validate()
{
if (string.IsNullOrWhiteSpace(Name))
{
throw new ValidationException("Client name cannot be empty");
}
if (Host is null)
{
throw new ValidationException("Host cannot be empty");
}
}
}