namespace Fengling.Console.Models.Dtos;

public class GatewayServiceDto
{
    public long Id { get; set; }
    public string ServicePrefix { get; set; } = "";
    public string ServiceName { get; set; } = "";
    public string Version { get; set; } = "v1";
    public string ClusterId { get; set; } = "";
    public string PathPattern { get; set; } = "";
    public string ServiceAddress { get; set; } = "";
    public string DestinationId { get; set; } = "";
    public int Weight { get; set; } = 1;
    public int InstanceCount { get; set; }
    public bool IsGlobal { get; set; }
    public string? TenantCode { get; set; }
    public int Status { get; set; } = 1;
    public DateTime CreatedAt { get; set; }
}

public class CreateGatewayServiceDto
{
    public string ServicePrefix { get; set; } = "";
    public string ServiceName { get; set; } = "";
    public string Version { get; set; } = "v1";
    public string ServiceAddress { get; set; } = "";
    public string DestinationId { get; set; } = "";
    public int Weight { get; set; } = 1;
    public bool IsGlobal { get; set; } = true;
    public string? TenantCode { get; set; }
}

public class GatewayRouteDto
{
    public long Id { get; set; }
    public string ServiceName { get; set; } = "";
    public string ClusterId { get; set; } = "";
    public string PathPattern { get; set; } = "";
    public int Priority { get; set; }
    public bool IsGlobal { get; set; }
    public string? TenantCode { get; set; }
    public int Status { get; set; }
    public int InstanceCount { get; set; }
}

public class CreateGatewayRouteDto
{
    public string ServiceName { get; set; } = "";
    public string ClusterId { get; set; } = "";
    public string PathPattern { get; set; } = "";
    public int Priority { get; set; } = 10;
    public bool IsGlobal { get; set; } = true;
    public string? TenantCode { get; set; }
}

public class GatewayInstanceDto
{
    public long Id { get; set; }
    public string ClusterId { get; set; } = "";
    public string DestinationId { get; set; } = "";
    public string Address { get; set; } = "";
    public int Weight { get; set; } = 1;
    public int Health { get; set; } = 1;
    public int Status { get; set; } = 1;
    public DateTime CreatedAt { get; set; }
}

public class CreateGatewayInstanceDto
{
    public string ClusterId { get; set; } = "";
    public string DestinationId { get; set; } = "";
    public string Address { get; set; } = "";
    public int Weight { get; set; } = 1;
}

public class GatewayStatisticsDto
{
    public int TotalServices { get; set; }
    public int GlobalRoutes { get; set; }
    public int TenantRoutes { get; set; }
    public int TotalInstances { get; set; }
    public int HealthyInstances { get; set; }
    public List<GatewayServiceDto> RecentServices { get; set; } = new();
}

public class GatewayUpdateWeightDto
{
    public int Weight { get; set; }
}
