namespace ExperionCrawler.Core.Application.DTOs;

public class ExperionServerConfigDto
{
    public string ServerHostName { get; set; } = "192.168.0.20";
    public int    Port           { get; set; } = 4840;
    public string ClientHostName { get; set; } = "dbsvr";
    public string UserName       { get; set; } = "mngr";
    public string Password       { get; set; } = "mngr";
}

public class ExperionCrawlRequestDto
{
    public ExperionServerConfigDto ServerConfig   { get; set; } = new();
    public List<string>            NodeIds        { get; set; } = new();
    public int                     IntervalSeconds { get; set; } = 1;
    public int                     DurationSeconds { get; set; } = 60;
}

public class ExperionReadTagRequestDto
{
    public ExperionServerConfigDto ServerConfig { get; set; } = new();
    public string                  NodeId       { get; set; } = string.Empty;
}

public class ExperionBrowseRequestDto
{
    public ExperionServerConfigDto ServerConfig  { get; set; } = new();
    public string?                 StartNodeId  { get; set; }
}

public class ExperionCertCreateDto
{
    public string       ClientHostName  { get; set; } = "dbsvr";
    public List<string> SubjectAltNames { get; set; } = new() { "localhost", "192.168.0.50"};
    public string       PfxPassword     { get; set; } = "";
}

public class ExperionCsvImportDto
{
    public string FileName       { get; set; } = string.Empty;
    public string ServerHostName { get; set; } = string.Empty;
    public bool   Truncate       { get; set; } = false;
}

public class ExperionNodeMapCrawlRequestDto
{
    public ExperionServerConfigDto ServerConfig { get; set; } = new();
    public int MaxDepth { get; set; } = 10;
}

public class PointBuilderBuildDto
{
    public List<string> Names     { get; set; } = new();
    public List<string> DataTypes { get; set; } = new();
}

public class PointBuilderAddDto
{
    public string NodeId { get; set; } = string.Empty;
}

// ── TimeScaleDB 하이퍼테이블 ────────────────────────────────────────────────────

public class HypertableStatusDto
{
    public bool IsHypertable { get; set; }
    public string? TableName { get; set; }
    public string? StatusMessage { get; set; }
    public int RecordCount { get; set; }
    public bool HasRetentionPolicy { get; set; }
    public bool HasCompression { get; set; }
    public bool HasContinuousAggregate { get; set; }
}

public class HypertableCreateDto
{
    public string TableName { get; set; } = "history_table";
    public string TimeColumn { get; set; } = "recorded_at";
    public string TimeInterval { get; set; } = "1 day";
    public bool MigrateData { get; set; } = true;
    public bool SetRetentionPolicy { get; set; } = true;
    public string RetentionPeriod { get; set; } = "90 days";
    public bool EnableCompression { get; set; } = true;
    public string CompressionPeriod { get; set; } = "1 day";
    public bool CreateContinuousAggregate { get; set; } = true;
}
