using static Insight.Web.Constants.Navigation.Monitoring;

namespace Insight.Web.Constants;

public static class Navigation
{
    public const string Home = "";

    public static class Internal
    {
        public const string Sessions = "internal/sessions";
        public const string Seed = "internal/seed";
    }

    public static class Account
    {
        public const string Index = "account";
        public const string Login = Index + "/login";
        public const string LoginTFA = Login + "/{key:guid}";
        public const string SignIn = Index + "/signin";
        public const string SignInTFA = SignIn + "/2fa";
        public const string Logout = Index + "/logout";
        public const string Lockout = Index + "/lockout";
        public const string Profile = Index + "/profile";
        public const string ChangePassword = Index + "/changepassword";

        public static string LoginHref(string redirect) => string.IsNullOrWhiteSpace(redirect) ? Login : $"{Login}?redirect={redirect}";
        public static string LoginTFAHref(Guid key) => LoginTFA.Replace("{key:guid}", key.ToString());

        public static string SignInHref(Guid key) => $"{SignIn}?key={key}";
        public static string SignInTFAHref(Guid key) => $"{SignInTFA}?key={key}";

        public static string ChangePasswordHref(Guid key) => $"{ChangePassword}?key={key}";
    }

    public static class Monitoring
    {
        public const string Index = "monitoring";

        public static class Maintenance
        {
            public const string Index = Monitoring.Index + "/maintenance";

            public static class Drives
            {
                public const string Index = Monitoring.Index + "/drives";
            }

            public static class StoragePools
            {
                public const string Index = Monitoring.Index + "/storagepools";
            }

            public static class Volumes
            {
                public const string Index = Monitoring.Index + "/volumes";
            }

            public static class Guests
            {
                public const string Index = Monitoring.Index + "/guests";
            }

            public static class Snapshots
            {
                public const string Index = Monitoring.Index + "/snapshots";
            }

            public static class Updates
            {
                public const string Index = Monitoring.Index + "/updates";
            }
        }
    }

    public static class Management
    {
        public const string Index = "management";

        public static class Accounts
        {
            public const string Index = Management.Index + "/accounts";
            public const string Details = Index + "/{accountId}";

            public static string DetailsHref(string? accountId) => Details.Replace("{accountId}", accountId);
        }

        public static class Customers
        {
            public const string Index = Management.Index + "/customers";
            public const string Details = Index + "/{customerId}";
            public const string Hosts = Details + "/hosts";
            public const string HostsAssign = Hosts + "/assign";

            public static string DetailsHref(string? customerId) => Details.Replace("{customerId}", customerId);
            public static string HostsHref(string? customerId) => Hosts.Replace("{customerId}", customerId);
            public static string HostsAssignHref(string? customerId) => HostsAssign.Replace("{customerId}", customerId);
        }

        public static class Agents
        {
            public const string Index = Management.Index + "/agents";
            public const string Details = Index + "/{agentId}";
            public const string Logs = Details + "/logs";
            public const string HostAssign = Details + "/assign";

            public static string DetailsHref(string? agentId) => Details.Replace("{agentId}", agentId);
            public static string LogsHref(string? agentId) => Logs.Replace("{agentId}", agentId);
            public static string HostAssingHref(string? agentId) => HostAssign.Replace("{agentId}", agentId);
        }

        public static class Hosts
        {
            public const string Index = Management.Index + "/hosts";
            public const string Details = Index + "/{hostId}";
            public const string Logs = Details + "/logs";
            public const string CustomerAssign = Details + "/customer/assign";
            public const string AgentAssign = Details + "/agent/assign";

            public static string DetailsHref(string? hostId) => Details.Replace("{hostId}", hostId);
            public static string LogsHref(string? hostId) => Logs.Replace("{hostId}", hostId);
            public static string CustomerAssingHref(string? hostId) => CustomerAssign.Replace("{hostId}", hostId);
            public static string AgentAssingHref(string? hostId) => AgentAssign.Replace("{hostId}", hostId);

            public static class Actions
            {
                public static class Console
                {
                    public const string Index = Hosts.Details + "/console";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                }
            }

            public static class Systems
            {
                public static class Os
                {
                    public const string Details = Hosts.Details + "/os";

                    public static string DetailsHref(string? hostId) => Details.Replace("{hostId}", hostId);
                }

                public static class Updates
                {
                    public static class Installed
                    {
                        public const string Index = Hosts.Details + "/updates/installed";

                        public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                    }

                    public static class Pending
                    {
                        public const string Index = Hosts.Details + "/updates/pending";

                        public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                    }
                }

                public static class Sessions
                {
                    public const string Index = Hosts.Details + "/sessions";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                }

                public static class Software
                {
                    public const string Index = Hosts.Details + "/software";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                }

                public static class Services
                {
                    public const string Index = Hosts.Details + "/services";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                }

                public static class Printers
                {
                    public const string Index = Hosts.Details + "/printers";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                }

                public static class Volumes
                {
                    public const string Index = Hosts.Details + "/volumes";
                    public const string Details = Index + "/{volumeId}";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                    public static string DetailsHref(string? hostId, string? volumeId) => Details.Replace("{hostId}", hostId).Replace("{volumeId}", volumeId);
                }

                public static class Users
                {
                    public const string Index = Hosts.Details + "/users";
                    public const string Details = Index + "/{userId}";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                    public static string DetailsHref(string? hostId, string? userId) => Details.Replace("{hostId}", hostId).Replace("{userId}", userId);
                }

                public static class Groups
                {
                    public const string Index = Hosts.Details + "/groups";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                }

                public static class StoragePools
                {
                    public const string Index = Hosts.Details + "/storagepools";
                    public const string Details = Index + "/{storagePoolId}";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                    public static string DetailsHref(string? hostId, string? storagePoolId) => Details.Replace("{hostId}", hostId).Replace("{storagePoolId}", storagePoolId);

                    public static class VirtualDisks
                    {
                        public const string Index = StoragePools.Details + "/virtualdisks";
                        public const string Details = Index + "/{virtualDiskId}";

                        public static string IndexHref(string? hostId, string? storagePoolId) => Index.Replace("{hostId}", hostId).Replace("{storagePoolId}", storagePoolId);
                        public static string DetailsHref(string? hostId, string? storagePoolId, string? virtualDiskId) => Details.Replace("{hostId}", hostId).Replace("{storagePoolId}", storagePoolId).Replace("{virtualDiskId}", virtualDiskId);
                    }

                    public static class PhysicalDisks
                    {
                        public const string Index = StoragePools.Details + "/physicaldisks";
                        public const string Details = Index + "/{physicalDiskId}";

                        public static string IndexHref(string? hostId, string? storagePoolId) => Index.Replace("{hostId}", hostId).Replace("{storagePoolId}", storagePoolId);
                        public static string DetailsHref(string? hostId, string? storagePoolId, string? physicalDiskId) => Details.Replace("{hostId}", hostId).Replace("{storagePoolId}", storagePoolId).Replace("{physicalDiskId}", physicalDiskId);
                    }
                }

                public static class VirtualMaschines
                {
                    public const string Index = Hosts.Details + "/virtualmaschines";
                    public const string Details = Index + "/{virtualMaschineId}";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                    public static string DetailsHref(string? hostId, string? virtualMaschineId) => Details.Replace("{hostId}", hostId).Replace("{virtualMaschineId}", virtualMaschineId);

                    public static class Snapshots
                    {
                        public const string Details = VirtualMaschines.Details + "/snapshots/{snapshotId}";

                        public static string DetailsHref(string? hostId, string? virtualMaschineId, string? snapshotId) => Details.Replace("{hostId}", hostId).Replace("{virtualMaschineId}", virtualMaschineId).Replace("{snapshotId}", snapshotId);
                    }
                }
            }

            public static class Network
            {
                public static class Interfaces
                {
                    public const string Index = Hosts.Details + "/interfaces";
                    public const string Details = Index + "/{interfaceId}";

                    public const string Addresses = Details + "/addresses";
                    public const string Nameservers = Details + "/nameservers";
                    public const string Gateways = Details + "/gateways";
                    public const string Routes = Details + "/routes";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                    public static string DetailsHref(string? hostId, string? interfaceId) => Details.Replace("{hostId}", hostId).Replace("{interfaceId}", interfaceId);
                }

                public static class Addresses
                {
                    public const string Index = Hosts.Details + "/addresses";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                }

                public static class Gateways
                {
                    public const string Index = Details + "/gateways";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                }

                public static class Nameservers
                {
                    public const string Index = Hosts.Details + "/nameservers";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                }

                public static class Routes
                {
                    public const string Index = Hosts.Details + "/routes";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                }
            }

            public static class Hardware
            {
                public static class Mainboard
                {
                    public const string Details = Hosts.Details + "/mainboard";

                    public static string DetailsHref(string? hostId) => Details.Replace("{hostId}", hostId);
                }

                public static class Processors
                {
                    public const string Details = Hosts.Details + "/processors";

                    public static string DetailsHref(string? hostId) => Details.Replace("{hostId}", hostId);
                }

                public static class Memory
                {
                    public const string Index = Hosts.Details + "/memory";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                }

                public static class Drives
                {
                    public const string Index = Hosts.Details + "/drives";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                }

                public static class Videocards
                {
                    public const string Index = Hosts.Details + "/videocards";

                    public static string IndexHref(string? hostId) => Index.Replace("{hostId}", hostId);
                }
            }
        }

        public static class HostGroups
        {
            public const string Index = Management.Index + "/hostgroups";
            public const string Details = Index + "/{groupId}";
            public const string Hosts = Details + "/hosts";
            public const string HostsAssign = Details + "/assign";

            public static string DetailsHref(string? groupId) => Details.Replace("{groupId}", groupId);
            public static string HostsHref(string? groupId) => Hosts.Replace("{groupId}", groupId);
            public static string HostsAssignHref(string? groupId) => HostsAssign.Replace("{groupId}", groupId);
        }

        public static class Scheduler
        {
            public const string Index = Management.Index + "/scheduler";

            public static class Jobs
            {
                public const string Index = Scheduler.Index + "/jobs";
                public const string Details = Index + "/{jobId}";
                public const string Tasks = Details + "/tasks";
                public const string TasksAssign = Tasks + "/assign";
                public const string Triggers = Details + "/triggers";
                public const string TriggersAssign = Triggers + "/assign";

                public static string DetailsHref(string? jobId) => Details.Replace("{jobId}", jobId);
                public static string TasksHref(string? jobId) => Tasks.Replace("{jobId}", jobId);
                public static string TasksAssignHref(string? jobId) => TasksAssign.Replace("{jobId}", jobId);
                public static string TriggersHref(string? jobId) => Triggers.Replace("{jobId}", jobId);
                public static string TriggersAssignHref(string? jobId) => TriggersAssign.Replace("{jobId}", jobId);
            }

            public static class Tasks
            {
                public const string Index = Scheduler.Index + "/tasks";
                public const string Details = Index + "/{taskId}";
                public const string Jobs = Details + "/jobs";

                public static string DetailsHref(string? taskId) => Details.Replace("{taskId}", taskId);
                public static string JobsHref(string? taskId) => Jobs.Replace("{taskId}", taskId);
            }

            public static class Triggers
            {
                public const string Index = Scheduler.Index + "/triggers";
                public const string Details = Index + "/{triggerId}";
                public const string Jobs = Details + "/jobs";

                public static string DetailsHref(string? triggerId) => Details.Replace("{triggerId}", triggerId);
                public static string JobsHref(string? triggerId) => Jobs.Replace("{triggerId}", triggerId);
            }
        }
    }

    public static class Inventory
    {
        public const string Index = "inventory";

        public static class Systems
        {
            public const string Index = Inventory.Index + "/system";

            public static class Os
            {
                public const string Index = Systems.Index + "/os";
                public const string Hosts = Index + "/{osName}/hosts";
                public const string Guests = Index + "/{osName}/guests";

                public static string HostsHref(string? osName) => Hosts.Replace("{osName}", osName);
                public static string GuestsHref(string? osName) => Guests.Replace("{osName}", osName);
            }

            public static class Updates
            {
                public const string Index = Systems.Index + "/updates";
                public const string Hosts = Index + "/{updateName}/hosts";

                public static string HostsHref(string? updateName) => Hosts.Replace("{updateName}", updateName);
            }

            public static class Software
            {
                public const string Index = Systems.Index + "/software";
                public const string Hosts = Index + "/{softwareName}/hosts";

                public static string HostsHref(string? software) => Hosts.Replace("{softwareName}", software);
            }

            public static class Services
            {
                public const string Index = Systems.Index + "/services";
                public const string Hosts = Index + "/{serviceName}/hosts";

                public static string HostsHref(string? serviceName) => Hosts.Replace("{serviceName}", serviceName);
            }

            public static class Sessions
            {
                public const string Index = Systems.Index + "/sessions";
            }

            public static class Printers
            {
                public const string Index = Systems.Index + "/printers";
            }

            public static class Volumes
            {
                public const string Index = Systems.Index + "/volumes";
            }

            public static class Users
            {
                public const string Index = Systems.Index + "/users";
                public const string Hosts = Index + "/{userName}/hosts";

                public static string HostsHref(string? userName) => Hosts.Replace("{userName}", userName);
            }

            public static class Groups
            {
                public const string Index = Systems.Index + "/groups";
                public const string Hosts = Index + "/{groupName}/hosts";

                public static string HostsHref(string? groupName) => Hosts.Replace("{groupName}", groupName);
            }

            public static class StoragePools
            {
                public const string Index = Systems.Index + "/storagepools";
            }

            public static class VirtualMaschines
            {
                public const string Index = Systems.Index + "/virtualmaschines";
            }
        }

        public static class Network
        {
            public const string Index = Inventory.Index + "/network";

            public static class Interfaces
            {
                public const string Index = Network.Index + "/interfaces";
            }

            public static class Addresses
            {
                public const string Index = Network.Index + "/addresses";
                public const string Hosts = Index + "/{address}/hosts";

                public static string HostsHref(string? address) => Hosts.Replace("{address}", address);
            }

            public static class Nameservers
            {
                public const string Index = Network.Index + "/nameservers";
                public const string Hosts = Index + "/{nameserverAddress}/hosts";

                public static string HostsHref(string? nameserverAddress) => Hosts.Replace("{nameserverAddress}", nameserverAddress);
            }

            public static class Gateways
            {
                public const string Index = Network.Index + "/gateways";
                public const string Hosts = Index + "/{gatewayAddress}/hosts";

                public static string HostsHref(string? gatewayAddress) => Hosts.Replace("{gatewayAddress}", gatewayAddress);
            }

            public static class Routes
            {
                public const string Index = Network.Index + "/routes";
                public const string Hosts = Index + "/{routeAddress}/hosts";

                public static string HostsHref(string? routeAddress) => Hosts.Replace("{routeAddress}", routeAddress);
            }
        }

        public static class Hardware
        {
            public const string Index = Inventory.Index + "/hardware";

            public static class Mainboards
            {
                public const string Index = Hardware.Index + "/mainboards";
                public const string Hosts = Index + "/{mainboardName}/hosts";

                public static string HostsHref(string? mainboardName) => Hosts.Replace("{mainboardName}", mainboardName);
            }

            public static class Processors
            {
                public const string Index = Hardware.Index + "/processors";
                public const string Hosts = Index + "/{processorName}/hosts";

                public static string HostsHref(string? processorName) => Hosts.Replace("{processorName}", processorName);
            }

            public static class Memory
            {
                public const string Index = Hardware.Index + "/memory";
                public const string Hosts = Index + "/{memoryName}/hosts";

                public static string HostsHref(string? memoryName) => Hosts.Replace("{memoryName}", memoryName);
            }

            public static class Drives
            {
                public const string Index = Hardware.Index + "/drives";
                public const string Hosts = Index + "/{driveName}/hosts";

                public static string HostsHref(string? driveName) => Hosts.Replace("{driveName}", driveName);
            }

            public static class Videocards
            {
                public const string Index = Hardware.Index + "/videocards";
                public const string Hosts = Index + "/{videocardName}/hosts";

                public static string HostsHref(string? videocardName) => Hosts.Replace("{videocardName}", videocardName);
            }
        }
    }
}