@using EzeScanWebApps.Licensing
@model EzeScanWebApps.Models.LicenseDataModel

     @if (Model.License != null && string.IsNullOrEmpty(Model.License.LicenseVersion))
     {
        <div class="alert alert-danger" role="alert"><strong>Error!</strong> Your license file is incompatible with this version of WebApps. Please contact your EzeScan WebApps Administrator for assistance.</div>
     }
     @if (!string.IsNullOrEmpty(Model.Error))
     {
         <div class="alert alert-danger" role="alert">@Model.Error</div>
     }
     @if (!string.IsNullOrEmpty(Model.StatusMessage))
     {
         <div class="alert alert-info" role="alert">@Model.StatusMessage</div>
     }

<p><strong>Server HostName:</strong> @(LicenseManager.HostName)</p>

@if (Model.License != null)
{
    <p><strong>License Status:</strong> @(Model.Status.Valid ? "License Valid" : "License Invalid")</p>
    <ul>
        <li>Host: @(Model.Status.CorrectHost ? "OK" : "Failed")</li>
        <li>Signature: @(Model.Status.Signed ? "OK" : "Failed")</li>
        <li>Expiry: @(!Model.Status.Expired ? "OK" : "Failed")</li>
    </ul>

    <p><strong>License Expiry Date:</strong> @Model.License.Expiry.ToString("D")</p>

    <p><strong>License Type:</strong> @(Model.License.Type)</p>

    if (Model.License.LicensedModules.Count > 0)
    {
        <p>
            <strong>Licensed Modules:</strong>
            @foreach (var module in Model.License.LicensedModules)
            {
                <div class="mb-2 card panel-license-module @(module.Enabled ? "border-success" : "")">
                    <div class="card-header">
                        <strong>@module.Name</strong>
                    </div>
                    <div class="card-body">
                        @if (module.Options != null)
                        {
                            foreach (var option in module.Options)
                            {
                                <span>@option.Name: @option.Value</span>
                            }
                        }
                    </div>
                </div>
            }

        </p>
    }
}
else
{
    <p><strong>License Status:</strong> @("License data not found")</p>
}
