using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Avalonia.Media;
using Material.Icons;
using ReactiveUI;

namespace PSCHelpdesk.Plugins.HetznerServer.Models;

public class Server : ReactiveObject
{
    public long Id { get; set; }
    public string Name { get; set; }
    
    public string Status { get; set; }
    
    private string _isGoodIcon = MaterialIconKind.AlertCircleOutline.ToString();
    
    public string IsGoodIcon
    {
        get => _isGoodIcon;
        set => this.RaiseAndSetIfChanged(ref _isGoodIcon, value);
    }
    
    private IImmutableSolidColorBrush? _isGoodColor = Brushes.Red;
    
    public IImmutableSolidColorBrush? IsGoodColor
    {
        get => _isGoodColor;
        set => this.RaiseAndSetIfChanged(ref _isGoodColor, value);
    }
    
    private String _rootDirUsed = "100%";
    
    public string RootDirUsed
    {
        get => _rootDirUsed;
        set => this.RaiseAndSetIfChanged(ref _rootDirUsed, value);
    }
    
    private String _dataDirUsed = "100%";
    
    public string DataDirUsed
    {
        get => _dataDirUsed;
        set => this.RaiseAndSetIfChanged(ref _dataDirUsed, value);
    }

    private String _mongoVersion = "";
    
    public string MongoVersion
    {
        get => _mongoVersion;
        set => this.RaiseAndSetIfChanged(ref _mongoVersion, value);
    }

    private int _runningContainerCount = 0;
    
    public int RunningContainerCount
    {
        get => _runningContainerCount;
        set => this.RaiseAndSetIfChanged(ref _runningContainerCount, value);
    }

    private String _mysqlVersion = "";
    
    public string MysqlVersion
    {
        get => _mysqlVersion;
        set => this.RaiseAndSetIfChanged(ref _mysqlVersion, value);
    }
    
    public string Type { get; set; }
    public string Ipv4 { get; set; }
    public string Ipv6 { get; set; }

    public Server(long id, string name, string type, string status, string ipv4, string ipv6)
    {
        Id = id;
        Name = name;
        Type = type;
        Status = status;
        Ipv4 = ipv4;
        Ipv6 = ipv6;
        this.Domains = new List<Domain>();
    }
    
    private List<Domain> _domains;
    
    public List<Domain> Domains
    {
        get => _domains;
        set => this.RaiseAndSetIfChanged(ref _domains, value);
    }
    
    private string _datum;
    
    public string Datum
    {
        get => _datum;
        set => this.RaiseAndSetIfChanged(ref _datum, value);
    }
    
    private float _release;
    
    public float Release
    {
        get => _release;
        set => this.RaiseAndSetIfChanged(ref _release, value);
    }

    private DateTime _backupLastModified;
    public DateTime BackupLastModified {
        get => _backupLastModified;
        set => this.RaiseAndSetIfChanged(ref _backupLastModified, value);
    }
    
    private bool _hasBackup = false;
    
    public bool HasBackup {
        get => _hasBackup;
        set => this.RaiseAndSetIfChanged(ref _hasBackup, value);
    }
}