namespace SwDAL.DTO.ServerConfig;
/// Write-side shape for MSERVERCONFIG — column list confirmed from the one existing
/// INSERT against this table (TCMSTestEnvQB.INSERT_MSERVERCONFIG), extended with
/// REPORTSERVERCONFIGID/ARCHIVESERVERCONFIGID (not set by TCMS's TEST-only rows) since those are
/// exactly the two columns this write path exists to populate. DatabasePassword must already be
/// encrypted (IApplicationConnection.Encrypt(plaintext, "GB5")) before being set here — this DTO
/// never carries plaintext.
public class MServerConfigWriteDTO
{
public int ServerConfigId { get; set; } // output — set by ExecuteIdentityAsync/OUTPUT
public string ConnectionName { get; set; } = string.Empty;
public int ServerId { get; set; }
public byte DatabaseType { get; set; } // 0=SqlServer,1=PostgreSQL,2=MySQL,3=Oracle
public string DatabaseName { get; set; } = string.Empty;
public string DatabaseUserName { get; set; } = string.Empty;
public string DatabasePassword { get; set; } = string.Empty; // encrypted, never plaintext
public string DatabasePort { get; set; } = string.Empty;
public string ControlSourceDbName { get; set; } = string.Empty;
/// New, additive convention (no prior value beyond TCMS's 1=TEST existed):
/// 0=Production/OLTP, 1=Test (TCMS-owned, do not reuse), 2=Report, 3=Archive.
public byte DbInstanceType { get; set; }
public byte Nature { get; set; }
public byte DbSourceType { get; set; }
/// Self-referencing default (-1 or own id, mirroring the legacy
/// ServerConfigDAL.SaveServerConfig convention) unless this row is itself a
/// Report/Archive satellite of a Main row.
public int SystemServerConfigId { get; set; } = -1;
public int ReportServerConfigId { get; set; } = -1;
public int ArchiveServerConfigId { get; set; } = -1;
public int ParentServerConfigId { get; set; } = -1;
public int ClientId { get; set; }
public int ClientSiteId { get; set; } = -1;
public string Remarks { get; set; } = string.Empty;
public byte Status { get; set; } = 1;
public short Version { get; set; } = 1;
public byte SourceType { get; set; } = 5;
public int CreatedById { get; set; }
public DateTime CreatedOn { get; set; }
public int ModifiedById { get; set; }
public DateTime ModifiedOn { get; set; }
public int Offset { get; set; } = 0;
public int MaxValue { get; set; } = 0;
public string FcmConfig { get; set; } = string.Empty;
public int ServiceServerId { get; set; } = -1;
}