'use client';

import { useOrderStore } from '@/stores/order';
import { Button } from '@repo/ui/components/ui/button';

export function NextButton() {
  const { clientId, date, masterId, nextStep, serviceId, step, time } = useOrderStore(
    (store) => store,
  );

  const isDisabled =
    (step === 'master-select' && !masterId) ||
    (step === 'client-select' && !clientId) ||
    (step === 'service-select' && !serviceId) ||
    (step === 'datetime-select' && (!date || !time));

  return (
    <Button className="w-full" disabled={isDisabled} onClick={nextStep} type="button">
      Далее
    </Button>
  );
}
