import React from 'react';
import { AlertCircle, Clock } from 'lucide-react';
import { Button } from '@/components/ui/button';

interface CheckInBlockerDialogProps {
  isOpen: boolean;
  onCheckIn: () => void;
  isLoading?: boolean;
  userName?: string;
}

const CheckInBlockerDialog: React.FC<CheckInBlockerDialogProps> = ({
  isOpen,
  onCheckIn,
  isLoading = false,
  userName = 'User',
}) => {
  if (!isOpen) return null;

  return (
    <div className="fixed inset-0 z-[999] flex items-center justify-center overflow-y-auto p-4">
      <div className="fixed inset-0 bg-black/80 backdrop-blur-sm" />
      
      <div className="relative z-[1000] w-full max-w-md rounded-lg border bg-background p-6 shadow-lg">
        <div className="flex gap-4 items-start mb-4">
          <div className="flex h-12 w-12 items-center justify-center rounded-full bg-orange-100 text-orange-600">
            <Clock className="h-6 w-6" />
          </div>
          <div className="flex-1">
            <h2 className="text-lg font-semibold">Check-In Required</h2>
            <p className="text-sm text-muted-foreground mt-2">
              Welcome back, <span className="font-medium">{userName}</span>! 
            </p>
            <p className="text-sm text-muted-foreground mt-1">
              You haven't checked in yet today. Please check in to continue using the application.
            </p>
          </div>
        </div>
        
        <div className="mt-6 p-4 bg-orange-50 border border-orange-200 rounded-md">
          <div className="flex items-start gap-2">
            <AlertCircle className="h-4 w-4 text-orange-600 mt-0.5 flex-shrink-0" />
            <p className="text-xs text-orange-800">
              Checking in helps track your attendance and working hours. This is required before accessing the system.
            </p>
          </div>
        </div>
        
        <div className="flex justify-end mt-6">
          <Button
            onClick={onCheckIn}
            disabled={isLoading}
            className="w-full sm:w-auto"
          >
            {isLoading ? 'Checking In...' : 'Check In Now'}
          </Button>
        </div>
      </div>
    </div>
  );
};

export default CheckInBlockerDialog;
