using System.ComponentModel.DataAnnotations;

namespace OTSSignsOrchestrator.Core.Models.DTOs;

public class CreateInstanceDto
{
    [Required, MaxLength(100)]
    public string CustomerName { get; set; } = string.Empty;

    /// <summary>Exactly 3 lowercase letters used to derive all resource names.</summary>
    [Required, MaxLength(3), MinLength(3), RegularExpression("^[a-z]{3}$", ErrorMessage = "Abbreviation must be exactly 3 lowercase letters.")]
    public string CustomerAbbrev { get; set; } = string.Empty;

    /// <summary>SSH host to deploy to.</summary>
    public Guid? SshHostId { get; set; }

    /// <summary>Pangolin Newt ID (optional — tunnel service excluded if not provided).</summary>
    [MaxLength(500)]
    public string? NewtId { get; set; }

    /// <summary>Pangolin Newt Secret (optional — tunnel service excluded if not provided).</summary>
    [MaxLength(500)]
    public string? NewtSecret { get; set; }

    // ── NFS volume settings (optional — falls back to global settings) ──

    [MaxLength(200)]
    public string? NfsServer { get; set; }

    /// <summary>NFS export path on the server (e.g. "/srv/nfs").</summary>
    [MaxLength(500)]
    public string? NfsExport { get; set; }

    /// <summary>Optional subfolder within the export (e.g. "ots_cms"). Omit to use the export root.</summary>
    [MaxLength(500)]
    public string? NfsExportFolder { get; set; }

    [MaxLength(500)]
    public string? NfsExtraOptions { get; set; }

    /// <summary>
    /// When true, any existing Docker volumes with the same stack prefix are removed before
    /// deploying, so fresh volumes are created from the current compose driver_opts.
    /// Defaults to false to avoid accidental data loss on re-deploys.
    /// </summary>
    public bool PurgeStaleVolumes { get; set; } = false;
}
