using System.ComponentModel.DataAnnotations;
namespace OTSSignsOrchestrator.Core.Models.Entities;
///
/// Represents a remote Docker Swarm host accessible over SSH.
/// SSH key paths or encrypted passwords are stored for authentication.
///
public class SshHost
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required, MaxLength(200)]
public string Label { get; set; } = string.Empty;
[Required, MaxLength(500)]
public string Host { get; set; } = string.Empty;
[Range(1, 65535)]
public int Port { get; set; } = 22;
[Required, MaxLength(100)]
public string Username { get; set; } = string.Empty;
///
/// Path to the SSH private key file on the local machine.
///
[MaxLength(1000)]
public string? PrivateKeyPath { get; set; }
///
/// Encrypted passphrase for the SSH key (if any). Protected by DataProtection.
///
[MaxLength(2000)]
public string? KeyPassphrase { get; set; }
///
/// Encrypted SSH password (if key-based auth is not used). Protected by DataProtection.
///
[MaxLength(2000)]
public string? Password { get; set; }
///
/// Whether to prefer key-based auth over password.
///
public bool UseKeyAuth { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
/// Last time a connection was successfully tested.
public DateTime? LastTestedAt { get; set; }
public bool? LastTestSuccess { get; set; }
}