import { Checkbox } from '@/components/ui/checkbox';
import { Label } from '@/components/ui/label';
import { PresenceInvisibleToggle } from './PresenceInvisibleToggle';
import { PrivacySettings as PrivacySettingsType } from '../types/settings';

interface PrivacySettingsProps {
  privacy: PrivacySettingsType;
  onChange: (privacy: PrivacySettingsType) => void;
}

export function PrivacySettings({ privacy, onChange }: PrivacySettingsProps) {
  const handleChange = (field: keyof PrivacySettingsType, value: boolean) => {
    onChange({
      ...privacy,
      [field]: value,
    });
  };

  return (
    <div className="space-y-6">
      <div className="space-y-4">
        <div className="flex items-center justify-between">
          <div className="space-y-0.5">
            <Label htmlFor="allow_search_indexing">
              Autoriser l'indexation par les moteurs de recherche
            </Label>
            <p className="text-sm text-muted-foreground">
              Permettre aux moteurs de recherche d'indexer votre profil
            </p>
          </div>
          <Checkbox
            id="allow_search_indexing"
            checked={privacy.allow_search_indexing}
            onCheckedChange={(checked) =>
              handleChange('allow_search_indexing', checked === true)
            }
          />
        </div>

        <div className="flex items-center justify-between">
          <div className="space-y-0.5">
            <Label htmlFor="show_activity">Afficher l'activité</Label>
            <p className="text-sm text-muted-foreground">
              Permettre aux autres utilisateurs de voir votre activité
            </p>
          </div>
          <Checkbox
            id="show_activity"
            checked={privacy.show_activity}
            onCheckedChange={(checked) =>
              handleChange('show_activity', checked === true)
            }
          />
        </div>

        {/* P2.2: Mode invisible */}
        <PresenceInvisibleToggle />
      </div>
    </div>
  );
}
