import { useAuthStore } from '../stores/authStore';
import SettingsLayout from '../components/layout/SettingsLayout';
import FreeVisitPrice from '../components/FreeVisitPrice';
import { ScheduleSection } from '../components/schedule/ScheduleSection';

/**
 * مدیریت نوبت دهی — the doctor's appointment settings: visit price and the full
 * weekly/overrides/holidays schedule (moved here from the doctor profile). The
 * schedule is now managed exclusively from this page.
 */
export default function AppointmentSettingsPage() {
  const doctorUuid = useAuthStore((s) => s.doctorUuid);
  const dbUuid     = useAuthStore((s) => s.dbUuid);
  const uuid = doctorUuid ?? dbUuid ?? undefined;

  return (
    <SettingsLayout active="appointment">
      <div
        style={{ background: 'var(--surface)', minWidth: 0 }}
        className="px-4 py-4 md:px-6 md:py-6 rounded-[var(--r-lg)]"
      >
        <h1 className="section-title" style={{ marginBottom: 16 }}>مدیریت نوبت دهی</h1>

        <FreeVisitPrice />

        {!uuid ? (
          <div className="card" style={{ padding: 32, textAlign: 'center', color: 'var(--text-3)', fontSize: 14 }}>
            این بخش فقط برای پزشک در دسترس است.
          </div>
        ) : (
          <ScheduleSection doctorUuid={uuid} />
        )}
      </div>
    </SettingsLayout>
  );
}
