@page
@model JobsMedical.Web.Pages.Facilities.IndexModel
@{
    ViewData["Title"] = "مراکز درمانی";
    string TypeLabel(FacilityType t) => t switch
    {
        FacilityType.Hospital => "بیمارستان",
        FacilityType.Clinic => "کلینیک",
        _ => "درمانگاه",
    };
}

<div class="page-head">
    <div class="container"><h1>مراکز درمانی</h1></div>
</div>

<div class="container section">
    <div class="grid grid-3">
        @foreach (var row in Model.Rows)
        {
            <a class="card card-pad" asp-page="/Facilities/Details" asp-route-id="@row.Facility.Id" style="display:block;">
                <div class="row" style="display:flex; justify-content:space-between; align-items:center;">
                    <span class="facility" style="font-weight:800; font-size:16px;">@row.Facility.Name</span>
                    @if (row.Facility.IsVerified)
                    {
                        <span class="badge badge-verified">✓</span>
                    }
                </div>
                <p class="muted" style="margin:8px 0;">
                    <span class="badge badge-type">@TypeLabel(row.Facility.Type)</span>
                    📍 @row.Facility.City?.Name
                </p>
                <div class="foot" style="display:flex; justify-content:space-between; align-items:center; border-top:1px solid var(--line); padding-top:12px;">
                    <span class="pay" style="color:var(--primary-dark); font-weight:800;">
                        @JalaliDate.ToPersianDigits(row.OpenListings.ToString()) آگهی فعال
                    </span>
                    <span class="btn btn-outline" style="padding:6px 14px;">مشاهده مرکز</span>
                </div>
            </a>
        }
    </div>
</div>
