{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "settings-privacy",
  "title": "Settings Privacy",
  "description": "Control privacy settings and data sharing preferences.",
  "registryDependencies": [
    "alert-dialog",
    "button",
    "card",
    "field",
    "select",
    "separator",
    "switch"
  ],
  "files": [
    {
      "path": "registry/new-york/blocks/settings/settings-privacy.tsx",
      "content": "\"use client\";\n\nimport { Download, Loader2, Lock, Save, Trash2 } from \"lucide-react\";\nimport { useState } from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport {\n  AlertDialog,\n  AlertDialogAction,\n  AlertDialogCancel,\n  AlertDialogContent,\n  AlertDialogDescription,\n  AlertDialogFooter,\n  AlertDialogHeader,\n  AlertDialogTitle,\n  AlertDialogTrigger,\n} from \"@/registry/new-york/ui/alert-dialog\";\nimport { Button } from \"@/registry/new-york/ui/button\";\nimport {\n  Card,\n  CardContent,\n  CardDescription,\n  CardHeader,\n  CardTitle,\n} from \"@/registry/new-york/ui/card\";\nimport {\n  Field,\n  FieldContent,\n  FieldDescription,\n  FieldLabel,\n} from \"@/registry/new-york/ui/field\";\nimport {\n  Select,\n  SelectContent,\n  SelectItem,\n  SelectTrigger,\n  SelectValue,\n} from \"@/registry/new-york/ui/select\";\nimport { Separator } from \"@/registry/new-york/ui/separator\";\nimport { Switch } from \"@/registry/new-york/ui/switch\";\n\nexport interface PrivacyData {\n  profileVisibility: \"public\" | \"private\";\n  showEmail: boolean;\n  showActivity: boolean;\n  analyticsOptOut: boolean;\n  marketingEmails: boolean;\n  thirdPartyIntegrations: boolean;\n  dataRetentionDays?: number;\n  twoFactorEnabled: boolean;\n  loginNotifications: boolean;\n}\n\nexport interface SettingsPrivacyProps {\n  privacy?: PrivacyData;\n  onSave?: (data: PrivacyData) => Promise<void>;\n  onExportData?: () => Promise<void>;\n  onDeleteAccount?: () => Promise<void>;\n  onEnable2FA?: () => Promise<void>;\n  className?: string;\n}\n\nconst defaultPrivacy: PrivacyData = {\n  profileVisibility: \"public\",\n  showEmail: false,\n  showActivity: true,\n  analyticsOptOut: false,\n  marketingEmails: true,\n  thirdPartyIntegrations: true,\n  dataRetentionDays: 365,\n  twoFactorEnabled: false,\n  loginNotifications: true,\n};\n\nexport default function SettingsPrivacy({\n  privacy = defaultPrivacy,\n  onSave,\n  onExportData,\n  onDeleteAccount,\n  onEnable2FA,\n  className,\n}: SettingsPrivacyProps) {\n  const [isSaving, setIsSaving] = useState(false);\n  const [isExporting, setIsExporting] = useState(false);\n  const [localPrivacy, setLocalPrivacy] = useState<PrivacyData>(privacy);\n\n  const handleSave = async () => {\n    setIsSaving(true);\n    try {\n      await onSave?.(localPrivacy);\n    } finally {\n      setIsSaving(false);\n    }\n  };\n\n  const handleExportData = async () => {\n    setIsExporting(true);\n    try {\n      await onExportData?.();\n    } finally {\n      setIsExporting(false);\n    }\n  };\n\n  const updatePrivacy = <K extends keyof PrivacyData>(\n    key: K,\n    value: PrivacyData[K]\n  ) => {\n    setLocalPrivacy((prev) => ({ ...prev, [key]: value }));\n  };\n\n  return (\n    <Card className={cn(\"w-full shadow-xs\", className)}>\n      <CardHeader>\n        <div className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\">\n          <div className=\"flex min-w-0 flex-1 flex-col gap-2\">\n            <CardTitle className=\"wrap-break-word\">Privacy Settings</CardTitle>\n            <CardDescription className=\"wrap-break-word\">\n              Control your privacy and data sharing preferences\n            </CardDescription>\n          </div>\n          <div className=\"flex shrink-0 gap-2\">\n            <Button\n              className=\"w-full sm:w-auto\"\n              disabled={isSaving}\n              onClick={handleSave}\n              type=\"button\"\n            >\n              {isSaving ? (\n                <>\n                  <Loader2 className=\"size-4 animate-spin\" />\n                  <span className=\"whitespace-nowrap\">Saving…</span>\n                </>\n              ) : (\n                <>\n                  <Save className=\"size-4\" />\n                  <span className=\"whitespace-nowrap\">Save Changes</span>\n                </>\n              )}\n            </Button>\n          </div>\n        </div>\n      </CardHeader>\n      <CardContent>\n        <div className=\"flex flex-col gap-6\">\n          {/* Profile Visibility */}\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"font-semibold text-base\">Profile Visibility</h3>\n            <Field>\n              <FieldLabel htmlFor=\"profile-visibility\">\n                Profile Visibility\n              </FieldLabel>\n              <FieldContent>\n                <Select\n                  onValueChange={(value: \"public\" | \"private\") =>\n                    updatePrivacy(\"profileVisibility\", value)\n                  }\n                  value={localPrivacy.profileVisibility}\n                >\n                  <SelectTrigger id=\"profile-visibility\">\n                    <SelectValue />\n                  </SelectTrigger>\n                  <SelectContent>\n                    <SelectItem value=\"public\">Public</SelectItem>\n                    <SelectItem value=\"private\">Private</SelectItem>\n                  </SelectContent>\n                </Select>\n                <FieldDescription>\n                  Control who can view your profile\n                </FieldDescription>\n              </FieldContent>\n            </Field>\n\n            <Field>\n              <div className=\"flex items-center justify-between\">\n                <div className=\"flex flex-col gap-1\">\n                  <FieldLabel htmlFor=\"show-email\">Show Email</FieldLabel>\n                  <FieldDescription>\n                    Display your email address on your profile\n                  </FieldDescription>\n                </div>\n                <Switch\n                  checked={localPrivacy.showEmail}\n                  id=\"show-email\"\n                  onCheckedChange={(checked) =>\n                    updatePrivacy(\"showEmail\", checked)\n                  }\n                />\n              </div>\n            </Field>\n\n            <Field>\n              <div className=\"flex items-center justify-between\">\n                <div className=\"flex flex-col gap-1\">\n                  <FieldLabel htmlFor=\"show-activity\">Show Activity</FieldLabel>\n                  <FieldDescription>\n                    Display your recent activity on your profile\n                  </FieldDescription>\n                </div>\n                <Switch\n                  checked={localPrivacy.showActivity}\n                  id=\"show-activity\"\n                  onCheckedChange={(checked) =>\n                    updatePrivacy(\"showActivity\", checked)\n                  }\n                />\n              </div>\n            </Field>\n          </div>\n\n          <Separator />\n\n          {/* Data Sharing */}\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"font-semibold text-base\">Data Sharing</h3>\n            <Field>\n              <div className=\"flex items-center justify-between\">\n                <div className=\"flex flex-col gap-1\">\n                  <FieldLabel htmlFor=\"analytics-opt-out\">\n                    Analytics Opt-Out\n                  </FieldLabel>\n                  <FieldDescription>\n                    Stop sharing usage analytics with us\n                  </FieldDescription>\n                </div>\n                <Switch\n                  checked={localPrivacy.analyticsOptOut}\n                  id=\"analytics-opt-out\"\n                  onCheckedChange={(checked) =>\n                    updatePrivacy(\"analyticsOptOut\", checked)\n                  }\n                />\n              </div>\n            </Field>\n\n            <Field>\n              <div className=\"flex items-center justify-between\">\n                <div className=\"flex flex-col gap-1\">\n                  <FieldLabel htmlFor=\"marketing-emails\">\n                    Marketing Emails\n                  </FieldLabel>\n                  <FieldDescription>\n                    Receive promotional emails and updates\n                  </FieldDescription>\n                </div>\n                <Switch\n                  checked={localPrivacy.marketingEmails}\n                  id=\"marketing-emails\"\n                  onCheckedChange={(checked) =>\n                    updatePrivacy(\"marketingEmails\", checked)\n                  }\n                />\n              </div>\n            </Field>\n\n            <Field>\n              <div className=\"flex items-center justify-between\">\n                <div className=\"flex flex-col gap-1\">\n                  <FieldLabel htmlFor=\"third-party\">\n                    Third-Party Integrations\n                  </FieldLabel>\n                  <FieldDescription>\n                    Allow data sharing with connected third-party services\n                  </FieldDescription>\n                </div>\n                <Switch\n                  checked={localPrivacy.thirdPartyIntegrations}\n                  id=\"third-party\"\n                  onCheckedChange={(checked) =>\n                    updatePrivacy(\"thirdPartyIntegrations\", checked)\n                  }\n                />\n              </div>\n            </Field>\n          </div>\n\n          <Separator />\n\n          {/* Security */}\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"font-semibold text-base\">Security</h3>\n            <Field>\n              <div className=\"flex items-center justify-between\">\n                <div className=\"flex flex-col gap-1\">\n                  <FieldLabel htmlFor=\"two-factor\">\n                    Two-Factor Authentication\n                  </FieldLabel>\n                  <FieldDescription>\n                    Add an extra layer of security to your account\n                  </FieldDescription>\n                </div>\n                <div className=\"flex items-center gap-2\">\n                  {localPrivacy.twoFactorEnabled ? (\n                    <span className=\"text-muted-foreground text-sm\">\n                      Enabled\n                    </span>\n                  ) : (\n                    <Button\n                      onClick={onEnable2FA}\n                      type=\"button\"\n                      variant=\"outline\"\n                    >\n                      <Lock className=\"size-4\" />\n                      Enable 2FA\n                    </Button>\n                  )}\n                </div>\n              </div>\n            </Field>\n\n            <Field>\n              <div className=\"flex items-center justify-between\">\n                <div className=\"flex flex-col gap-1\">\n                  <FieldLabel htmlFor=\"login-notifications\">\n                    Login Notifications\n                  </FieldLabel>\n                  <FieldDescription>\n                    Get notified when someone logs into your account\n                  </FieldDescription>\n                </div>\n                <Switch\n                  checked={localPrivacy.loginNotifications}\n                  id=\"login-notifications\"\n                  onCheckedChange={(checked) =>\n                    updatePrivacy(\"loginNotifications\", checked)\n                  }\n                />\n              </div>\n            </Field>\n          </div>\n\n          <Separator />\n\n          {/* Data Management */}\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"font-semibold text-base\">Data Management</h3>\n            <Field>\n              <FieldLabel htmlFor=\"data-retention\">Data Retention</FieldLabel>\n              <FieldContent>\n                <Select\n                  onValueChange={(value) =>\n                    updatePrivacy(\"dataRetentionDays\", Number.parseInt(value))\n                  }\n                  value={localPrivacy.dataRetentionDays?.toString() || \"365\"}\n                >\n                  <SelectTrigger id=\"data-retention\">\n                    <SelectValue />\n                  </SelectTrigger>\n                  <SelectContent>\n                    <SelectItem value=\"30\">30 days</SelectItem>\n                    <SelectItem value=\"90\">90 days</SelectItem>\n                    <SelectItem value=\"180\">180 days</SelectItem>\n                    <SelectItem value=\"365\">1 year</SelectItem>\n                    <SelectItem value=\"730\">2 years</SelectItem>\n                    <SelectItem value=\"0\">Indefinitely</SelectItem>\n                  </SelectContent>\n                </Select>\n                <FieldDescription>\n                  How long to keep your activity history\n                </FieldDescription>\n              </FieldContent>\n            </Field>\n\n            <div className=\"flex flex-col gap-2\">\n              <Button\n                className=\"w-full sm:w-auto\"\n                disabled={isExporting}\n                onClick={handleExportData}\n                type=\"button\"\n                variant=\"outline\"\n              >\n                {isExporting ? (\n                  <>\n                    <Loader2 className=\"size-4 animate-spin\" />\n                    Exporting…\n                  </>\n                ) : (\n                  <>\n                    <Download className=\"size-4\" />\n                    Export My Data\n                  </>\n                )}\n              </Button>\n              <p className=\"text-muted-foreground text-xs\">\n                Download a copy of all your data in JSON format\n              </p>\n            </div>\n\n            <Separator />\n\n            <div className=\"flex flex-col gap-2\">\n              <AlertDialog>\n                <AlertDialogTrigger asChild>\n                  <Button\n                    className=\"w-full sm:w-auto\"\n                    type=\"button\"\n                    variant=\"destructive\"\n                  >\n                    <Trash2 className=\"size-4\" />\n                    Delete Account\n                  </Button>\n                </AlertDialogTrigger>\n                <AlertDialogContent>\n                  <AlertDialogHeader>\n                    <AlertDialogTitle>Delete Account</AlertDialogTitle>\n                    <AlertDialogDescription>\n                      Are you sure you want to delete your account? This action\n                      cannot be undone. All your data will be permanently\n                      deleted.\n                    </AlertDialogDescription>\n                  </AlertDialogHeader>\n                  <AlertDialogFooter>\n                    <AlertDialogCancel>Cancel</AlertDialogCancel>\n                    <AlertDialogAction\n                      className=\"bg-destructive text-destructive-foreground hover:bg-destructive/90\"\n                      onClick={onDeleteAccount}\n                    >\n                      Delete Account\n                    </AlertDialogAction>\n                  </AlertDialogFooter>\n                </AlertDialogContent>\n              </AlertDialog>\n              <p className=\"text-muted-foreground text-xs\">\n                Permanently delete your account and all associated data\n              </p>\n            </div>\n          </div>\n        </div>\n      </CardContent>\n    </Card>\n  );\n}\n",
      "type": "registry:ui"
    }
  ],
  "categories": [
    "block",
    "settings"
  ],
  "type": "registry:ui"
}