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 = "account/login";
        public const string LoginTFA = "account/login/{key:guid}";
        public const string SignIn = "account/signin";
        public const string SignInTFA = "account/signin/2fa";
        public const string Logout = "account/logout";
        public const string Lockout = "account/lockout";
        public const string Profile = "account/profile";
        public const string ChangePassword = "account/changepassword";      

        public static string LoginHref(string redirect)
        {
            if (string.IsNullOrWhiteSpace(redirect))
            {
                return Login;
            }

            return $"{Login}?redirect={redirect}";
        }

        public static string LoginTFAHref(Guid key)
        {
            return LoginTFA.Replace("{key:guid}", key.ToString());
        }

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

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

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

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

        public static class Maintenance
        {
            public const string Index = "monitoring/maintenance";

            public static class Drives
            {
                public const string Index = "monitoring/maintenance/drives";
            }

            public static class StoragePools
            {
                public const string Index = "monitoring/maintenance/storagepools";
            }

            public static class Volumes
            {
                public const string Index = "monitoring/maintenance/volumes";
            }

            public static class Guests
            {
                public const string Index = "monitoring/maintenance/guests";
            }

            public static class Snapshots
            {
                public const string Index = "monitoring/maintenance/snapshots";
            }

            public static class Updates
            {
                public const string Index = "monitoring/maintenance/updates";
            }
        }
    }

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

        public static class Overview
        {
            public const string Index = "management/overview";
        }

        public static class Accounts
        {
            public const string Index = "management/accounts";
            public const string Details = "management/accounts/{accountId}";
            
            public static string DetailsHref(string? accountId)
            {
                return Details.Replace("{accountId}", accountId);
            }
        }

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

            public static string DetailsHref(string? customerId)
            {
                return Details.Replace("{customerId}", customerId);
            }

            public static string HostsHref(string? customerId)
            {
                return Hosts.Replace("{customerId}", customerId);
            }

            public static string HostsAssignHref(string? customerId)
            {
                return HostsAssign.Replace("{customerId}", customerId);
            }
        }

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

            public static string DetailsHref(string? agentId)
            {
                return Details.Replace("{agentId}", agentId);
            }

            public static string LogsHref(string? agentId)
            {
                return Logs.Replace("{agentId}", agentId);
            }

            public static string HostAssingHref(string? agentId)
            {
                return HostAssign.Replace("{agentId}", agentId);
            }
        }

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

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

            public static string LogsHref(string? hostId)
            {
                return Logs.Replace("{hostId}", hostId);
            }

            public static string CustomerAssingHref(string? hostId)
            {
                return CustomerAssign.Replace("{hostId}", hostId);
            }

            public static string AgentAssingHref(string? hostId)
            {
                return AgentAssign.Replace("{hostId}", hostId);
            }

            public static class Actions
            {
                public static class Console
                {
                    public const string Index = "management/hosts/{hostId}/console";

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

            public static class Systems
            {
                public static class Os
                {
                    public const string Details = "management/hosts/{hostId}/os";

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

                public static class Updates
                {
                    public static class Installed
                    {
                        public const string Index = "management/hosts/{hostId}/updates/installed";

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

                    public static class Pending
                    {
                        public const string Index = "management/hosts/{hostId}/updates/pending";

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

                public static class Sessions
                {
                    public const string Index = "management/hosts/{hostId}/sessions";

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

                public static class Software
                {
                    public const string Index = "management/hosts/{hostId}/software";

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

                public static class Services
                {
                    public const string Index = "management/hosts/{hostId}/services";

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

                public static class Printers
                {
                    public const string Index = "management/hosts/{hostId}/printers";

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

                public static class Volumes
                {
                    public const string Index = "management/hosts/{hostId}/volumes";
                    public const string Details = "management/hosts/{hostId}/volumes/{volumeId}";

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

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

                public static class Users
                {
                    public const string Index = "management/hosts/{hostId}/users";
                    public const string Details = "management/hosts/{hostId}/users/{userId}";

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

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

                public static class Groups
                {
                    public const string Index = "management/hosts/{hostId}/groups";

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

                public static class StoragePools
                {
                    public const string Index = "management/hosts/{hostId}/storagepools";
                    public const string Details = "management/hosts/{hostId}/storagepools/{storagePoolId}";

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

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

                    public static class VirtualDisks
                    {
                        public const string Index = "management/hosts/{hostId}/storagepools/{storagePoolId}/virtualdisks";
                        public const string Details = "management/hosts/{hostId}/storagepools/{storagePoolId}/virtualdisks/{virtualDiskId}";

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

                        public static string DetailsHref(string? hostId, string? storagePoolId, string? virtualDiskId)
                        {
                            return Details.Replace("{hostId}", hostId).Replace("{storagePoolId}", storagePoolId).Replace("{virtualDiskId}", virtualDiskId);
                        }
                    }

                    public static class PhysicalDisks
                    {
                        public const string Index = "management/hosts/{hostId}/storagepools/{storagePoolId}/physicaldisks";
                        public const string Details = "management/hosts/{hostId}/storagepools/{storagePoolId}/physicaldisks/{physicalDiskId}";

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

                        public static string DetailsHref(string? hostId, string? storagePoolId, string? physicalDiskId)
                        {
                            return Details.Replace("{hostId}", hostId).Replace("{storagePoolId}", storagePoolId).Replace("{physicalDiskId}", physicalDiskId);
                        }
                    }
                }

                public static class VirtualMaschines
                {
                    public const string Index = "management/hosts/{hostId}/virtualmaschines";
                    public const string Details = "management/hosts/{hostId}/virtualmaschines/{virtualMaschineId}";

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

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

                    public static class Snapshots
                    {
                        public const string Details = "management/hosts/{hostId}/virtualmaschines/{virtualMaschineId}/snapshots/{snapshotId}";

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

            public static class Network
            {
                public static class Interfaces
                {
                    public const string Index = "management/hosts/{hostId}/interfaces";
                    public const string Details = "management/hosts/{hostId}/interfaces/{interfaceId}";

                    public const string Addresses = "management/hosts/{hostId}/interfaces/{interfaceId}/addresses";
                    public const string Nameservers = "management/hosts/{hostId}/interfaces/{interfaceId}/nameservers";
                    public const string Gateways = "management/hosts/{hostId}/interfaces/{interfaceId}/gateways";
                    public const string Routes = "management/hosts/{hostId}/interfaces/{interfaceId}/routes";

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

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

                public static class Addresses
                {
                    public const string Index = "management/hosts/{hostId}/addresses";

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

                public static class Gateways
                {
                    public const string Index = "management/hosts/{hostId}/gateways";

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

                public static class Nameservers
                {
                    public const string Index = "management/hosts/{hostId}/nameservers";

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

                public static class Routes
                {
                    public const string Index = "management/hosts/{hostId}/routes";

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

            public static class Hardware
            {
                public static class Mainboard
                {
                    public const string Details = "management/hosts/{hostId}/mainboard";

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

                public static class Processors
                {
                    public const string Details = "management/hosts/{hostId}/processors";

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

                public static class Memory
                {
                    public const string Index = "management/hosts/{hostId}/memory";

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

                public static class Drives
                {
                    public const string Index = "management/hosts/{hostId}/drives";

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

                public static class Videocards
                {
                    public const string Index = "management/hosts/{hostId}/videocards";

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

        public static class HostGroups
        {
            public const string Index = "management/hostgroups";
            public const string Details = "management/hostgroups/{groupId}";

            public static string DetailsHref(string? groupId)
            {
                return Details.Replace("{groupId}", groupId);
            }
        }
    }

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

                public static string HostsHref(string? osName)
                {
                    return Hosts.Replace("{osName}", osName);
                }

                public static string GuestsHref(string? osName)
                {
                    return Guests.Replace("{osName}", osName);
                }
            }

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

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

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

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

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

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

            public static class Sessions
            {
                public const string Index = "inventory/sessions";
            }

            public static class Printers
            {
                public const string Index = "inventory/printers";
            }

            public static class Volumes
            {
                public const string Index = "inventory/volumes";
            }

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

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

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

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

            public static class StoragePools
            {
                public const string Index = "inventory/storagepools";
            }

            public static class VirtualMaschines
            {
                public const string Index = "inventory/virtualmaschines";
            }
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    public static class Communication
    {
        public const string Index = "communication";

        public static class Chat
        {
            public const string Index = "communication/chat";
        }
    }
}