import React, { useMemo, useState } from 'react';
import { Link } from 'react-router-dom';
import {
CreditCardIcon, UserIcon, CalendarDaysIcon, BuildingOffice2Icon,
WrenchScrewdriverIcon, BanknotesIcon, UsersIcon, ShieldCheckIcon,
TagIcon, ChatBubbleLeftRightIcon, UserCircleIcon, MagnifyingGlassIcon,
} from '@heroicons/react/24/outline';
// ── Settings menu configuration ─────────────────────────────────────────────
// Single source of truth for the settings sub-navigation (desktop shell +
// mobile list). `to` = an existing admin route; items without `to` are not yet
// implemented and render as disabled placeholders ("بهزودی").
export type SettingsMenuItem = {
key: string;
label: string;
icon: React.ElementType;
to?: string;
};
export const SETTINGS_MENU: SettingsMenuItem[] = [
{ key: 'subscription', label: 'خرید اشتراک', icon: CreditCardIcon, to: '/admin/subscription' },
{ key: 'doctor', label: 'مدیریت پزشک', icon: UserIcon, to: '/admin/profile' },
{ key: 'appointment', label: 'مدیریت نوبت دهی', icon: CalendarDaysIcon, to: '/admin/appointment-settings' },
{ key: 'clinic', label: 'مدیریت مطب', icon: BuildingOffice2Icon, to: '/admin/my-clinic' },
{ key: 'services', label: 'خدمات', icon: WrenchScrewdriverIcon, to: '/admin/clinic-services' },
{ key: 'payment', label: 'مدیریت پرداخت', icon: BanknotesIcon, to: '/admin/my-financial' },
{ key: 'secretary', label: 'مدیریت منشی', icon: UsersIcon, to: '/admin/my-secretaries' },
{ key: 'insurance', label: 'مدیریت بیمه', icon: ShieldCheckIcon, to: '/admin/insurance-pricing' },
{ key: 'tags', label: 'برچسبها', icon: TagIcon, to: '/admin/tags-settings' },
{ key: 'sms', label: 'پیامکها', icon: ChatBubbleLeftRightIcon, to: '/admin/sms-wallet' },
{ key: 'account', label: 'حساب کاربری', icon: UserCircleIcon, to: '/admin/account-settings' },
];
// ── Shared item styling ──────────────────────────────────────────────────────
function itemStyle(active: boolean, disabled: boolean): React.CSSProperties {
return {
display: 'flex', alignItems: 'center', gap: 10,
width: '100%', padding: '11px 14px', borderRadius: 'var(--r-sm)',
fontSize: 14, fontWeight: active ? 700 : 500, textAlign: 'right',
fontFamily: 'inherit', border: 'none', cursor: disabled ? 'not-allowed' : 'pointer',
background: active ? 'var(--accent)' : 'transparent',
color: active ? '#fff' : disabled ? 'var(--text-3)' : 'var(--text-2)',
transition: 'background .14s, color .14s',
};
}
function MenuRow({ item, active }: { item: SettingsMenuItem; active: boolean }) {
const Icon = item.icon;
const disabled = !item.to;
const inner = (
<>