{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "maintenance-request-ticket",
  "title": "Maintenance Request Ticket",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-react/blocks/maintenance-request-ticket/MaintenanceRequestTicket.tsx",
      "content": "'use client'\n\nimport * as React from 'react'\nimport { useState } from 'react'\nimport {\n  AlertCircle,\n  Bug,\n  Building2,\n  Check,\n  CheckCircle2,\n  ChevronDown,\n  Clock,\n  Droplets,\n  FileImage,\n  FileVideo,\n  Flame,\n  KeyRound,\n  PhoneCall,\n  Plus,\n  RefreshCw,\n  ShieldAlert,\n  ShieldCheck,\n  Trash2,\n  UploadCloud,\n  UserCheck,\n  Wrench,\n  Zap,\n} from 'lucide-react'\nimport { cn } from '@/lib/utils'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'\nimport { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'\nimport {\n  Select,\n  SelectContent,\n  SelectGroup,\n  SelectItem,\n  SelectLabel,\n  SelectTrigger,\n  SelectValue,\n} from '@/components/ui/select'\nimport { Separator } from '@/components/ui/separator'\nimport { Textarea } from '@/components/ui/textarea'\n\nexport interface AttachedFile {\n  id: string\n  name: string\n  size: string\n  type: 'image' | 'video'\n  uploadedAt: string\n}\n\nexport interface MaintenanceRequestTicketProps {\n  className?: string\n  initialCategory?: string\n  initialUrgency?: 'routine' | 'standard' | 'emergency'\n  initialLocation?: string\n  initialDescription?: string\n  initialPermission?: 'granted' | 'call_first'\n  initialFiles?: AttachedFile[]\n}\n\nconst defaultFiles: AttachedFile[] = [\n  {\n    id: 'f-1',\n    name: 'kitchen-sink-leak-pipe.jpg',\n    size: '2.4 MB',\n    type: 'image',\n    uploadedAt: 'Today, 10:14 AM',\n  },\n  {\n    id: 'f-2',\n    name: 'disposal-motor-hum.mp4',\n    size: '8.1 MB',\n    type: 'video',\n    uploadedAt: 'Today, 10:16 AM',\n  },\n]\n\nconst categories = [\n  {\n    id: 'plumbing',\n    label: 'Plumbing & Leaks',\n    description: 'Faucets, pipes, toilets, drains',\n    icon: Droplets,\n    badgeColor: 'text-info bg-info/10 text-info',\n  },\n  {\n    id: 'electrical',\n    label: 'Electrical & Lighting',\n    description: 'Outlets, switches, fixtures, breakers',\n    icon: Zap,\n    badgeColor: 'text-warning bg-warning/10 text-warning',\n  },\n  {\n    id: 'hvac',\n    label: 'HVAC & AC Heating',\n    description: 'AC, thermostat, heater, airflow',\n    icon: Flame,\n    badgeColor: 'text-chart-2 bg-chart-2/10',\n  },\n  {\n    id: 'appliances',\n    label: 'Appliances',\n    description: 'Dishwasher, oven, disposal, fridge',\n    icon: Wrench,\n    badgeColor: 'text-chart-1 bg-chart-1/10',\n  },\n  {\n    id: 'locks',\n    label: 'Doors & Locks',\n    description: 'Keys, latches, deadbolts, windows',\n    icon: KeyRound,\n    badgeColor: 'text-success bg-success/10 text-success',\n  },\n  {\n    id: 'pest',\n    label: 'Pest Control',\n    description: 'Insects, rodents, preventative traps',\n    icon: Bug,\n    badgeColor: 'text-destructive bg-destructive/10 text-destructive',\n  },\n]\n\nconst urgencyOptions = [\n  {\n    value: 'routine',\n    label: 'Low / Routine',\n    badge: '3–5 Business Days',\n    badgeVariant: 'outline' as const,\n    description: 'Non-urgent preventative maintenance or routine hardware adjustments.',\n  },\n  {\n    value: 'standard',\n    label: 'Medium / Standard 48h',\n    badge: '24–48h SLA',\n    badgeVariant: 'secondary' as const,\n    description: 'Standard repair with moderate impact on daily convenience or appliance usage.',\n  },\n  {\n    value: 'emergency',\n    label: 'High / Emergency 2h SLA',\n    badge: 'Emergency < 2h',\n    badgeVariant: 'destructive' as const,\n    description: 'Immediate hazard to property or habitability. Triggers 24/7 on-call dispatch.',\n  },\n]\n\nconst locationOptions = [\n  { value: 'kitchen', label: 'Kitchen' },\n  { value: 'master_bathroom', label: 'Master Bathroom' },\n  { value: 'guest_bathroom', label: 'Guest Bathroom' },\n  { value: 'living_room', label: 'Living Room' },\n  { value: 'balcony', label: 'Balcony / Patio' },\n  { value: 'master_bedroom', label: 'Master Bedroom' },\n  { value: 'guest_bedroom', label: 'Guest Bedroom' },\n  { value: 'hallway', label: 'Hallway / Entryway' },\n  { value: 'laundry', label: 'Laundry & Utility Closet' },\n]\n\nconst quickSnippets = [\n  'Motor humming but not spinning',\n  'Water leaking under sink',\n  'Reset button tripped',\n  'Slow draining',\n]\n\nconst maxChars = 500\n\nexport function MaintenanceRequestTicket({\n  className,\n  initialCategory = 'appliances',\n  initialUrgency = 'standard',\n  initialLocation = 'kitchen',\n  initialDescription = 'Kitchen sink garbage disposal is jammed and leaking slightly under the cabinet when water runs. Motor makes a low humming sound.',\n  initialPermission = 'granted',\n  initialFiles = defaultFiles,\n}: MaintenanceRequestTicketProps) {\n  const [category, setCategory] = useState<string>(initialCategory)\n  const [urgency, setUrgency] = useState<'routine' | 'standard' | 'emergency'>(initialUrgency)\n  const [location, setLocation] = useState<string>(initialLocation)\n  const [description, setDescription] = useState<string>(initialDescription)\n  const [permission, setPermission] = useState<'granted' | 'call_first'>(initialPermission)\n  const [attachedFiles, setAttachedFiles] = useState<AttachedFile[]>([...initialFiles])\n  const [isDragging, setIsDragging] = useState(false)\n  const [showOpenRequests, setShowOpenRequests] = useState(false)\n  const [isSubmitting, setIsSubmitting] = useState(false)\n  const [isSubmitted, setIsSubmitted] = useState(false)\n  const [draftSaved, setDraftSaved] = useState(false)\n  const [generatedTicketId, setGeneratedTicketId] = useState('MNT-9042')\n\n  const descriptionLength = description.length\n\n  const appendSnippet = (snippet: string) => {\n    if (!description) {\n      setDescription(snippet)\n    } else if (!description.includes(snippet)) {\n      setDescription(`${description.trim()} ${snippet}.`)\n    }\n  }\n\n  const removeFile = (id: string) => {\n    setAttachedFiles((prev) => prev.filter((f) => f.id !== id))\n  }\n\n  const handleDrop = (e: React.DragEvent<HTMLDivElement>) => {\n    e.preventDefault()\n    setIsDragging(false)\n    if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) {\n      const newFiles: AttachedFile[] = []\n      for (let i = 0; i < e.dataTransfer.files.length; i++) {\n        const file = e.dataTransfer.files[i]\n        newFiles.push({\n          id: `f-${Date.now()}-${i}`,\n          name: file.name,\n          size: `${(file.size / (1024 * 1024)).toFixed(1)} MB`,\n          type: file.type.startsWith('video') ? 'video' : 'image',\n          uploadedAt: 'Just now',\n        })\n      }\n      setAttachedFiles((prev) => [...prev, ...newFiles])\n    }\n  }\n\n  const simulateAddFile = () => {\n    const sampleNames = ['cabinet-water-mark.jpg', 'under-sink-plumbing.jpg', 'noise-recording.mp4']\n    const randomName = sampleNames[attachedFiles.length % sampleNames.length]\n    setAttachedFiles((prev) => [\n      ...prev,\n      {\n        id: `f-${Date.now()}`,\n        name: randomName,\n        size: '3.1 MB',\n        type: randomName.endsWith('.mp4') ? 'video' : 'image',\n        uploadedAt: 'Just now',\n      },\n    ])\n  }\n\n  const handleSaveDraft = () => {\n    setDraftSaved(true)\n    setTimeout(() => {\n      setDraftSaved(false)\n    }, 3000)\n  }\n\n  const handleSubmit = () => {\n    setIsSubmitting(true)\n    setTimeout(() => {\n      setIsSubmitting(false)\n      setIsSubmitted(true)\n      setGeneratedTicketId(`MNT-${Math.floor(1000 + Math.random() * 9000)}`)\n    }, 700)\n  }\n\n  const handleReset = () => {\n    setIsSubmitted(false)\n    setCategory('appliances')\n    setUrgency('standard')\n    setLocation('kitchen')\n    setDescription(\n      'Kitchen sink garbage disposal is jammed and leaking slightly under the cabinet when water runs. Motor makes a low humming sound.',\n    )\n    setPermission('granted')\n    setAttachedFiles([\n      {\n        id: 'f-1',\n        name: 'kitchen-sink-leak-pipe.jpg',\n        size: '2.4 MB',\n        type: 'image',\n        uploadedAt: 'Today, 10:14 AM',\n      },\n      {\n        id: 'f-2',\n        name: 'disposal-motor-hum.mp4',\n        size: '8.1 MB',\n        type: 'video',\n        uploadedAt: 'Today, 10:16 AM',\n      },\n    ])\n  }\n\n  return (\n    <div data-slot=\"maintenance-request-ticket\" className={cn('w-full space-y-6', className)}>\n      {/* Header Banner */}\n      <Card className=\"border-border shadow-xs\">\n        <CardContent className=\"p-4 sm:p-6\">\n          <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n            <div className=\"space-y-1.5\">\n              <div className=\"flex flex-wrap items-center gap-2.5\">\n                <h1 className=\"text-foreground text-xl font-bold tracking-tight sm:text-2xl\">\n                  Submit Maintenance Request\n                </h1>\n                <Badge variant=\"outline\" className=\"gap-1.5 font-mono text-xs\">\n                  <span className=\"bg-success size-1.5 rounded-full\" />\n                  Unit 4B · Pacific Heights\n                </Badge>\n              </div>\n              <p className=\"text-muted-foreground text-sm\">\n                Resident: <span className=\"text-foreground font-medium\">Elena Rostova</span> · Facility maintenance &\n                repair portal\n              </p>\n            </div>\n\n            <div className=\"flex flex-wrap items-center gap-2.5\">\n              <div className=\"bg-muted/60 border-border inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 text-xs\">\n                <span className=\"relative flex size-2\">\n                  <span className=\"bg-warning absolute inline-flex size-full rounded-full opacity-75\" />\n                  <span className=\"bg-warning relative inline-flex size-2 rounded-full\" />\n                </span>\n                <span className=\"text-foreground font-medium\">1 In Progress</span>\n                <span className=\"text-muted-foreground hidden sm:inline\">· #MNT-8821</span>\n              </div>\n              <Button\n                variant=\"outline\"\n                size=\"sm\"\n                className=\"gap-1.5 shadow-xs\"\n                onClick={() => setShowOpenRequests(!showOpenRequests)}\n              >\n                <span>{showOpenRequests ? 'Hide Open Requests' : 'View Open Requests'}</span>\n                <ChevronDown\n                  className={cn('size-3.5 transition-transform duration-200', showOpenRequests && 'rotate-180')}\n                />\n              </Button>\n            </div>\n          </div>\n\n          {/* Collapsible Active Work Orders Panel */}\n          {showOpenRequests && (\n            <div className=\"border-border bg-muted/30 mt-4 space-y-3 rounded-lg border p-4 transition-colors\">\n              <div className=\"flex items-center justify-between\">\n                <div className=\"flex items-center gap-2\">\n                  <Clock className=\"text-muted-foreground size-4\" />\n                  <span className=\"text-foreground text-xs font-semibold tracking-wider uppercase\">\n                    Currently Active Work Orders (1)\n                  </span>\n                </div>\n                <Badge variant=\"secondary\" className=\"text-xs\">\n                  Technician Assigned\n                </Badge>\n              </div>\n              <div className=\"bg-card border-border flex flex-col justify-between gap-3 rounded-md border p-3 sm:flex-row sm:items-center\">\n                <div className=\"space-y-1\">\n                  <div className=\"flex items-center gap-2\">\n                    <span className=\"text-foreground text-sm font-semibold\">\n                      #MNT-8821 · HVAC Filter & Thermostat Inspection\n                    </span>\n                    <Badge variant=\"outline\" className=\"text-xs\">\n                      Living Room\n                    </Badge>\n                  </div>\n                  <p className=\"text-muted-foreground text-xs\">\n                    Assigned to: <span className=\"text-foreground font-medium\">Dave Miller (Lead HVAC Specialist)</span>{' '}\n                    · Scheduled window: Today 2:00 PM – 4:00 PM\n                  </p>\n                </div>\n                <div className=\"flex shrink-0 items-center gap-2\">\n                  <Badge variant=\"info\" className=\"text-xs\">\n                    In Progress\n                  </Badge>\n                </div>\n              </div>\n            </div>\n          )}\n        </CardContent>\n      </Card>\n\n      {/* Main 2-Column Layout */}\n      <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-12 lg:gap-8\">\n        {/* Left Column: Work Order Form (8 cols) */}\n        <div className=\"space-y-6 lg:col-span-8\">\n          {/* Submission Success State */}\n          {isSubmitted ? (\n            <Card className=\"border-success/30 bg-success/5 dark:bg-success/10 shadow-xs\">\n              <CardContent className=\"space-y-4 p-6 text-center sm:p-8\">\n                <div className=\"bg-success/10 text-success mx-auto flex size-14 items-center justify-center rounded-full\">\n                  <CheckCircle2 className=\"size-8\" />\n                </div>\n                <div className=\"space-y-2\">\n                  <h2 className=\"text-foreground text-xl font-bold\">Maintenance Request Submitted!</h2>\n                  <p className=\"text-muted-foreground mx-auto max-w-md text-sm\">\n                    Your request <span className=\"text-foreground font-mono font-semibold\">#{generatedTicketId}</span>{' '}\n                    has been logged and dispatched to the Pacific Heights Facility Operations team.\n                  </p>\n                </div>\n                <div className=\"border-border bg-card mx-auto max-w-lg space-y-2 rounded-lg border p-4 text-left text-xs\">\n                  <div className=\"flex justify-between\">\n                    <span className=\"text-muted-foreground\">Ticket ID:</span>\n                    <span className=\"text-foreground font-mono font-medium\">#{generatedTicketId}</span>\n                  </div>\n                  <div className=\"flex justify-between\">\n                    <span className=\"text-muted-foreground\">Unit:</span>\n                    <span className=\"text-foreground font-medium\">Unit 4B (Pacific Heights)</span>\n                  </div>\n                  <div className=\"flex justify-between\">\n                    <span className=\"text-muted-foreground\">Category:</span>\n                    <span className=\"text-foreground font-medium capitalize\">{category}</span>\n                  </div>\n                  <div className=\"flex justify-between\">\n                    <span className=\"text-muted-foreground\">Urgency Tier:</span>\n                    <span className=\"text-foreground font-medium capitalize\">{urgency} SLA</span>\n                  </div>\n                  <div className=\"flex justify-between\">\n                    <span className=\"text-muted-foreground\">Entry Authorization:</span>\n                    <span className=\"text-foreground font-medium\">\n                      {permission === 'granted' ? 'Permission Granted (Master Key)' : 'Call Resident First'}\n                    </span>\n                  </div>\n                </div>\n                <div className=\"flex flex-wrap justify-center gap-3 pt-2\">\n                  <Button className=\"gap-1.5 shadow-xs\" onClick={handleReset}>\n                    <RefreshCw className=\"size-4\" />\n                    <span>Submit Another Request</span>\n                  </Button>\n                </div>\n              </CardContent>\n            </Card>\n          ) : (\n            <Card className=\"border-border shadow-xs\">\n              <CardHeader className=\"pb-4\">\n                <CardTitle className=\"text-lg\">Work Order Details</CardTitle>\n                <CardDescription>Complete the fields below to schedule a maintenance technician visit.</CardDescription>\n              </CardHeader>\n\n              <CardContent className=\"space-y-6\">\n                {/* 1. Category Selection Grid */}\n                <div className=\"space-y-3\">\n                  <div className=\"flex items-center justify-between\">\n                    <label className=\"text-foreground text-sm font-semibold\">\n                      1. Issue Category <span className=\"text-destructive\">*</span>\n                    </label>\n                    <span className=\"text-muted-foreground text-xs\">Select one primary discipline</span>\n                  </div>\n\n                  <div className=\"grid grid-cols-2 gap-3 sm:grid-cols-3\">\n                    {categories.map((cat) => {\n                      const Icon = cat.icon\n                      const isSelected = category === cat.id\n                      return (\n                        <button\n                          key={cat.id}\n                          type=\"button\"\n                          aria-pressed={isSelected}\n                          className={cn(\n                            'group focus-visible:ring-ring relative flex cursor-pointer flex-col items-start gap-2.5 rounded-lg border p-3.5 text-left transition-colors outline-none select-none focus-visible:ring-2',\n                            isSelected\n                              ? 'border-primary bg-primary/5 ring-primary/30 shadow-xs ring-1'\n                              : 'border-border bg-card hover:bg-muted/40 hover:border-muted-foreground/30',\n                          )}\n                          onClick={() => setCategory(cat.id)}\n                        >\n                          <div className=\"flex w-full items-center justify-between\">\n                            <div className={cn('flex size-8 items-center justify-center rounded-md', cat.badgeColor)}>\n                              <Icon className=\"size-4.5\" />\n                            </div>\n                            <div\n                              className={cn(\n                                'flex size-4 items-center justify-center rounded-full border transition-colors',\n                                isSelected\n                                  ? 'border-primary bg-primary text-primary-foreground'\n                                  : 'border-muted-foreground/30 opacity-0 group-hover:opacity-60',\n                              )}\n                            >\n                              {isSelected && <Check className=\"size-2.5 stroke-[3]\" />}\n                            </div>\n                          </div>\n                          <div>\n                            <p className=\"text-foreground text-xs font-semibold\">{cat.label}</p>\n                            <p className=\"text-muted-foreground mt-0.5 line-clamp-1 text-xs\">{cat.description}</p>\n                          </div>\n                        </button>\n                      )\n                    })}\n                  </div>\n                </div>\n\n                <Separator />\n\n                {/* 2. Urgency Level Radios */}\n                <div className=\"space-y-3\">\n                  <div className=\"flex items-center justify-between\">\n                    <label className=\"text-foreground text-sm font-semibold\">\n                      2. Urgency Priority <span className=\"text-destructive\">*</span>\n                    </label>\n                    <span className=\"text-muted-foreground text-xs\">Determines facility response window</span>\n                  </div>\n\n                  {/* Emergency Banner Alert if High Selected */}\n                  {urgency === 'emergency' && (\n                    <div className=\"border-destructive/30 bg-destructive/10 text-destructive flex items-start gap-3 rounded-lg border p-3.5 text-xs\">\n                      <AlertCircle className=\"mt-0.5 size-4 shrink-0\" />\n                      <div className=\"space-y-1\">\n                        <p className=\"font-semibold\">High / Emergency SLA Activated</p>\n                        <p className=\"text-destructive/90 leading-relaxed\">\n                          Emergency requests notify on-call building engineers immediately. For active gas leaks or\n                          major structural flooding, call the 24/7 hotline directly at <strong>(415) 555-0192</strong>.\n                        </p>\n                      </div>\n                    </div>\n                  )}\n\n                  <RadioGroup\n                    value={urgency}\n                    onValueChange={(val) => setUrgency(val as 'routine' | 'standard' | 'emergency')}\n                    className=\"grid gap-3 sm:grid-cols-3\"\n                  >\n                    {urgencyOptions.map((opt) => (\n                      <div\n                        key={opt.value}\n                        className={cn(\n                          'border-border relative flex cursor-pointer flex-col justify-between gap-3 rounded-lg border p-3.5 transition-colors',\n                          urgency === opt.value\n                            ? 'border-primary bg-primary/5 ring-primary/30 shadow-xs ring-1'\n                            : 'bg-card hover:bg-muted/40 hover:border-muted-foreground/30',\n                        )}\n                        onClick={() => setUrgency(opt.value as any)}\n                      >\n                        <div className=\"flex items-start justify-between gap-2\">\n                          <div className=\"flex items-center gap-2\">\n                            <RadioGroupItem id={`urgency-${opt.value}`} value={opt.value} />\n                            <label\n                              htmlFor={`urgency-${opt.value}`}\n                              className=\"text-foreground cursor-pointer text-xs font-semibold select-none\"\n                            >\n                              {opt.label}\n                            </label>\n                          </div>\n                        </div>\n                        <div>\n                          <Badge variant={opt.badgeVariant} className=\"mb-1 text-xs\">\n                            {opt.badge}\n                          </Badge>\n                          <p className=\"text-muted-foreground text-xs leading-relaxed\">{opt.description}</p>\n                        </div>\n                      </div>\n                    ))}\n                  </RadioGroup>\n                </div>\n\n                <Separator />\n\n                {/* 3. Location in Unit */}\n                <div className=\"space-y-3\">\n                  <div className=\"flex items-center justify-between\">\n                    <label className=\"text-foreground text-sm font-semibold\">\n                      3. Location in Unit <span className=\"text-destructive\">*</span>\n                    </label>\n                    <span className=\"text-muted-foreground text-xs\">Specific area or room</span>\n                  </div>\n\n                  <Select value={location} onValueChange={setLocation}>\n                    <SelectTrigger className=\"w-full\">\n                      <SelectValue placeholder=\"Select location in unit...\" />\n                    </SelectTrigger>\n                    <SelectContent>\n                      <SelectGroup>\n                        <SelectLabel>Unit 4B Interior Areas</SelectLabel>\n                        {locationOptions.map((loc) => (\n                          <SelectItem key={loc.value} value={loc.value}>\n                            {loc.label}\n                          </SelectItem>\n                        ))}\n                      </SelectGroup>\n                    </SelectContent>\n                  </Select>\n                </div>\n\n                <Separator />\n\n                {/* 4. Issue Description */}\n                <div className=\"space-y-3\">\n                  <div className=\"flex items-center justify-between\">\n                    <label htmlFor=\"mnt-description\" className=\"text-foreground text-sm font-semibold\">\n                      4. Issue Description <span className=\"text-destructive\">*</span>\n                    </label>\n                    <span\n                      className={cn(\n                        'text-xs',\n                        descriptionLength > maxChars ? 'text-destructive font-medium' : 'text-muted-foreground',\n                      )}\n                    >\n                      {descriptionLength} / {maxChars}\n                    </span>\n                  </div>\n\n                  <Textarea\n                    id=\"mnt-description\"\n                    value={description}\n                    onValueChange={setDescription}\n                    rows={4}\n                    placeholder=\"Please describe the maintenance issue with as much detail as possible...\"\n                    className=\"w-full text-sm\"\n                  />\n\n                  {/* Quick Snippet Helper Chips */}\n                  <div className=\"space-y-1.5\">\n                    <p className=\"text-muted-foreground text-xs\">Quick details:</p>\n                    <div className=\"flex flex-wrap gap-1.5\">\n                      {quickSnippets.map((chip) => (\n                        <button\n                          key={chip}\n                          type=\"button\"\n                          className=\"bg-muted hover:bg-muted/80 text-muted-foreground hover:text-foreground inline-flex cursor-pointer items-center gap-1 rounded-md px-2.5 py-1 text-xs transition-colors\"\n                          onClick={() => appendSnippet(chip)}\n                        >\n                          <Plus className=\"size-3\" />\n                          <span>{chip}</span>\n                        </button>\n                      ))}\n                    </div>\n                  </div>\n                </div>\n\n                <Separator />\n\n                {/* 5. Permission to Enter Unit */}\n                <div className=\"space-y-3\">\n                  <div className=\"flex items-center justify-between\">\n                    <label className=\"text-foreground text-sm font-semibold\">\n                      5. Permission to Enter Unit <span className=\"text-destructive\">*</span>\n                    </label>\n                    <span className=\"text-muted-foreground text-xs\">Access protocol</span>\n                  </div>\n\n                  <RadioGroup\n                    value={permission}\n                    onValueChange={(val) => setPermission(val as 'granted' | 'call_first')}\n                    className=\"grid gap-3 sm:grid-cols-2\"\n                  >\n                    <div\n                      className={cn(\n                        'border-border relative flex cursor-pointer flex-col justify-between gap-2.5 rounded-lg border p-4 transition-colors',\n                        permission === 'granted'\n                          ? 'border-primary bg-primary/5 ring-primary/30 shadow-xs ring-1'\n                          : 'bg-card hover:bg-muted/40 hover:border-muted-foreground/30',\n                      )}\n                      onClick={() => setPermission('granted')}\n                    >\n                      <div className=\"flex items-start gap-2.5\">\n                        <RadioGroupItem id=\"perm-granted\" value=\"granted\" className=\"mt-0.5\" />\n                        <div className=\"space-y-1\">\n                          <label\n                            htmlFor=\"perm-granted\"\n                            className=\"text-foreground cursor-pointer text-xs font-semibold select-none\"\n                          >\n                            Permission Granted to Enter\n                          </label>\n                          <p className=\"text-muted-foreground text-xs leading-relaxed\">\n                            Authorized staff may enter with master key if resident is not home. Work order sign-off\n                            notice will be left in unit.\n                          </p>\n                        </div>\n                      </div>\n                      <div className=\"text-success flex items-center gap-1.5 pl-6 text-xs font-medium\">\n                        <UserCheck className=\"size-3.5\" />\n                        <span>Faster dispatch window</span>\n                      </div>\n                    </div>\n\n                    <div\n                      className={cn(\n                        'border-border relative flex cursor-pointer flex-col justify-between gap-2.5 rounded-lg border p-4 transition-colors',\n                        permission === 'call_first'\n                          ? 'border-primary bg-primary/5 ring-primary/30 shadow-xs ring-1'\n                          : 'bg-card hover:bg-muted/40 hover:border-muted-foreground/30',\n                      )}\n                      onClick={() => setPermission('call_first')}\n                    >\n                      <div className=\"flex items-start gap-2.5\">\n                        <RadioGroupItem id=\"perm-call\" value=\"call_first\" className=\"mt-0.5\" />\n                        <div className=\"space-y-1\">\n                          <label\n                            htmlFor=\"perm-call\"\n                            className=\"text-foreground cursor-pointer text-xs font-semibold select-none\"\n                          >\n                            Call Resident Before Entering\n                          </label>\n                          <p className=\"text-muted-foreground text-xs leading-relaxed\">\n                            Technician must call <span className=\"text-foreground font-medium\">(415) 890-4412</span> 30\n                            mins prior to arrival. Adult must be present.\n                          </p>\n                        </div>\n                      </div>\n                      <div className=\"text-muted-foreground flex items-center gap-1.5 pl-6 text-xs\">\n                        <Clock className=\"size-3.5\" />\n                        <span>Requires resident appointment</span>\n                      </div>\n                    </div>\n                  </RadioGroup>\n                </div>\n\n                <Separator />\n\n                {/* 6. Photo & Video Dropzone */}\n                <div className=\"space-y-3\">\n                  <div className=\"flex items-center justify-between\">\n                    <label className=\"text-foreground text-sm font-semibold\">\n                      6. Photo & Video Dropzone{' '}\n                      <span className=\"text-muted-foreground text-xs font-normal\">(Optional)</span>\n                    </label>\n                    <span className=\"text-muted-foreground text-xs\">{attachedFiles.length} Attached</span>\n                  </div>\n\n                  {/* Interactive Drop Area */}\n                  <div\n                    className={cn(\n                      'cursor-pointer rounded-lg border-2 border-dashed p-6 text-center transition-colors',\n                      isDragging\n                        ? 'border-primary bg-primary/10'\n                        : 'border-border bg-muted/20 hover:border-muted-foreground/40 hover:bg-muted/40',\n                    )}\n                    onDragOver={(e) => {\n                      e.preventDefault()\n                      setIsDragging(true)\n                    }}\n                    onDragLeave={(e) => {\n                      e.preventDefault()\n                      setIsDragging(false)\n                    }}\n                    onDrop={handleDrop}\n                    onClick={simulateAddFile}\n                  >\n                    <div className=\"bg-muted text-muted-foreground mx-auto flex size-10 items-center justify-center rounded-full\">\n                      <UploadCloud className=\"size-5\" />\n                    </div>\n                    <div className=\"mt-2.5 space-y-1\">\n                      <p className=\"text-foreground text-xs font-medium\">\n                        <span className=\"text-primary font-semibold hover:underline\">Click to upload</span> or drag and\n                        drop media files\n                      </p>\n                      <p className=\"text-muted-foreground text-xs\">\n                        PNG, JPG, HEIC, MP4 up to 25MB (helps technician arrive with correct parts)\n                      </p>\n                    </div>\n                  </div>\n\n                  {/* Attached Files Previews */}\n                  {attachedFiles.length > 0 && (\n                    <div className=\"space-y-2 pt-1\">\n                      {attachedFiles.map((f) => (\n                        <div\n                          key={f.id}\n                          className=\"bg-card border-border flex items-center justify-between gap-3 rounded-lg border p-2.5 text-xs transition-colors\"\n                        >\n                          <div className=\"flex min-w-0 items-center gap-2.5\">\n                            <div className=\"bg-primary/10 text-primary flex size-8 shrink-0 items-center justify-center rounded-md\">\n                              {f.type === 'video' ? <FileVideo className=\"size-4\" /> : <FileImage className=\"size-4\" />}\n                            </div>\n                            <div className=\"min-w-0\">\n                              <p className=\"text-foreground truncate font-medium\">{f.name}</p>\n                              <p className=\"text-muted-foreground text-xs\">\n                                {f.size} · {f.uploadedAt}\n                              </p>\n                            </div>\n                          </div>\n                          <div className=\"flex shrink-0 items-center gap-2\">\n                            <Badge variant=\"outline\" className=\"border-success/30 text-success text-xs\">\n                              Attached\n                            </Badge>\n                            <Button\n                              variant=\"ghost\"\n                              size=\"icon-sm\"\n                              className=\"text-muted-foreground hover:text-destructive size-7\"\n                              onClick={() => removeFile(f.id)}\n                            >\n                              <Trash2 className=\"size-3.5\" />\n                              <span className=\"sr-only\">Remove file</span>\n                            </Button>\n                          </div>\n                        </div>\n                      ))}\n                    </div>\n                  )}\n                </div>\n              </CardContent>\n\n              <CardFooter className=\"border-border bg-muted/20 flex flex-col-reverse justify-between gap-3 border-t p-4 sm:flex-row sm:items-center\">\n                <div className=\"flex items-center gap-2\">\n                  <Button\n                    variant=\"outline\"\n                    size=\"sm\"\n                    className=\"shadow-xs\"\n                    disabled={isSubmitting}\n                    onClick={handleSaveDraft}\n                  >\n                    <span>{draftSaved ? 'Draft Saved!' : 'Save as Draft'}</span>\n                  </Button>\n                  {draftSaved && (\n                    <span className=\"text-success flex items-center gap-1 text-xs\">\n                      <Check className=\"size-3\" />\n                      Saved locally\n                    </span>\n                  )}\n                </div>\n\n                <Button\n                  size=\"default\"\n                  className=\"w-full gap-2 shadow-xs sm:w-auto\"\n                  disabled={isSubmitting || !description.trim()}\n                  onClick={handleSubmit}\n                >\n                  {!isSubmitting ? <Wrench className=\"size-4\" /> : <RefreshCw className=\"size-4 animate-spin\" />}\n                  <span>{isSubmitting ? 'Dispatching Work Order...' : 'Submit Maintenance Request'}</span>\n                </Button>\n              </CardFooter>\n            </Card>\n          )}\n        </div>\n\n        {/* Right Column: Emergency & SLA Sidebar (4 cols) */}\n        <div className=\"space-y-6 lg:sticky lg:top-6 lg:col-span-4\">\n          {/* 24/7 Emergency Maintenance Hotline Card */}\n          <Card className=\"border-destructive/40 bg-destructive/5 dark:bg-destructive/10 shadow-xs\">\n            <CardHeader className=\"pb-3\">\n              <div className=\"text-destructive flex items-center gap-2\">\n                <ShieldAlert className=\"size-5 shrink-0\" />\n                <CardTitle className=\"text-destructive text-base\">24/7 Emergency Hotline</CardTitle>\n              </div>\n              <CardDescription className=\"text-foreground/80 text-xs\">\n                For urgent situations threatening life safety, gas leaks, or active flooding.\n              </CardDescription>\n            </CardHeader>\n            <CardContent className=\"space-y-4\">\n              <div className=\"bg-card border-destructive/30 space-y-1 rounded-lg border p-3 text-center\">\n                <p className=\"text-muted-foreground text-xs font-medium\">Immediate Dispatch Phone</p>\n                <p className=\"text-foreground font-mono text-xl font-semibold tracking-tight\">(415) 555-0192</p>\n                <p className=\"text-muted-foreground text-xs\">Facility Operations On-Call Desk</p>\n              </div>\n\n              <div className=\"space-y-2\">\n                <p className=\"text-foreground text-xs font-semibold\">What qualifies as an emergency:</p>\n                <ul className=\"text-muted-foreground space-y-1.5 text-xs\">\n                  <li className=\"flex items-start gap-2\">\n                    <span className=\"text-destructive font-bold\">•</span>\n                    <span>Active uncontrolled water leaks or burst pipes</span>\n                  </li>\n                  <li className=\"flex items-start gap-2\">\n                    <span className=\"text-destructive font-bold\">•</span>\n                    <span>Smell of natural gas or carbon monoxide alert</span>\n                  </li>\n                  <li className=\"flex items-start gap-2\">\n                    <span className=\"text-destructive font-bold\">•</span>\n                    <span>Complete electrical power loss in unit</span>\n                  </li>\n                  <li className=\"flex items-start gap-2\">\n                    <span className=\"text-destructive font-bold\">•</span>\n                    <span>Inoperable exterior lock or door security issue</span>\n                  </li>\n                  <li className=\"flex items-start gap-2\">\n                    <span className=\"text-destructive font-bold\">•</span>\n                    <span>Total loss of heating when temp is below 55°F</span>\n                  </li>\n                </ul>\n              </div>\n\n              <Button asChild variant=\"destructive\" className=\"w-full gap-2 shadow-xs\">\n                <a href=\"tel:4155550192\">\n                  <PhoneCall className=\"size-4\" />\n                  <span>Call Emergency Dispatch</span>\n                </a>\n              </Button>\n            </CardContent>\n          </Card>\n\n          {/* Service Level Agreement (SLA) Card */}\n          <Card className=\"border-border shadow-xs\">\n            <CardHeader className=\"pb-3\">\n              <div className=\"flex items-center gap-2\">\n                <Clock className=\"text-primary size-4.5\" />\n                <CardTitle className=\"text-base\">Service Level Agreement (SLA)</CardTitle>\n              </div>\n              <CardDescription className=\"text-xs\">\n                Response benchmarks for Pacific Heights property maintenance.\n              </CardDescription>\n            </CardHeader>\n            <CardContent className=\"space-y-3.5\">\n              <div className=\"bg-muted/40 border-border space-y-2 rounded-lg border p-3\">\n                <div className=\"flex items-center justify-between\">\n                  <div className=\"flex items-center gap-2\">\n                    <span className=\"bg-destructive size-2 rounded-full\" />\n                    <span className=\"text-foreground text-xs font-semibold\">Emergency Priority</span>\n                  </div>\n                  <Badge variant=\"destructive\" className=\"text-xs\">\n                    &lt; 2 Hours\n                  </Badge>\n                </div>\n                <p className=\"text-muted-foreground text-xs\">\n                  24/7/365 immediate dispatch with on-call technician response.\n                </p>\n              </div>\n\n              <div className=\"bg-muted/40 border-border space-y-2 rounded-lg border p-3\">\n                <div className=\"flex items-center justify-between\">\n                  <div className=\"flex items-center gap-2\">\n                    <span className=\"bg-secondary-foreground size-2 rounded-full\" />\n                    <span className=\"text-foreground text-xs font-semibold\">Standard Priority</span>\n                  </div>\n                  <Badge variant=\"secondary\" className=\"text-xs\">\n                    24–48 Hours\n                  </Badge>\n                </div>\n                <p className=\"text-muted-foreground text-xs\">\n                  Standard repairs scheduled Mon–Fri during normal operational hours.\n                </p>\n              </div>\n\n              <div className=\"bg-muted/40 border-border space-y-2 rounded-lg border p-3\">\n                <div className=\"flex items-center justify-between\">\n                  <div className=\"flex items-center gap-2\">\n                    <span className=\"bg-muted-foreground size-2 rounded-full\" />\n                    <span className=\"text-foreground text-xs font-semibold\">Routine / Preventative</span>\n                  </div>\n                  <Badge variant=\"outline\" className=\"text-xs\">\n                    3–5 Days\n                  </Badge>\n                </div>\n                <p className=\"text-muted-foreground text-xs\">\n                  Filter changes, caulking touch-ups, and scheduled inspections.\n                </p>\n              </div>\n\n              <div className=\"border-border bg-card flex items-start gap-2.5 rounded-lg border p-3 text-xs\">\n                <ShieldCheck className=\"text-primary mt-0.5 size-4 shrink-0\" />\n                <p className=\"text-muted-foreground leading-relaxed\">\n                  Status notifications are automatically sent via SMS and resident email as work orders progress.\n                </p>\n              </div>\n            </CardContent>\n          </Card>\n\n          {/* Building Operations Info Card */}\n          <Card className=\"border-border shadow-xs\">\n            <CardHeader className=\"pb-3\">\n              <div className=\"flex items-center gap-2\">\n                <Building2 className=\"text-muted-foreground size-4.5\" />\n                <CardTitle className=\"text-base\">Building Operations</CardTitle>\n              </div>\n            </CardHeader>\n            <CardContent className=\"space-y-2.5 text-xs\">\n              <div className=\"border-border/60 flex justify-between border-b py-1\">\n                <span className=\"text-muted-foreground\">Building Super:</span>\n                <span className=\"text-foreground font-medium\">Marcus Vance (Office #102)</span>\n              </div>\n              <div className=\"border-border/60 flex justify-between border-b py-1\">\n                <span className=\"text-muted-foreground\">Service Window:</span>\n                <span className=\"text-foreground font-medium\">Mon – Sat · 8:00 AM – 6:00 PM</span>\n              </div>\n              <div className=\"border-border/60 flex justify-between border-b py-1\">\n                <span className=\"text-muted-foreground\">Quiet Hours:</span>\n                <span className=\"text-foreground font-medium\">10:00 PM – 8:00 AM</span>\n              </div>\n              <div className=\"flex justify-between py-1\">\n                <span className=\"text-muted-foreground\">Resident Portal ID:</span>\n                <span className=\"text-foreground font-mono font-medium\">PH-RES-4B</span>\n              </div>\n            </CardContent>\n          </Card>\n        </div>\n      </div>\n    </div>\n  )\n}\n\nexport default MaintenanceRequestTicket\n",
      "type": "registry:block",
      "target": "~/components/blocks/MaintenanceRequestTicket.tsx"
    }
  ],
  "dependencies": [
    "lucide-react"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://uipkge.dev/r/react/badge.json",
    "https://uipkge.dev/r/react/button.json",
    "https://uipkge.dev/r/react/card.json",
    "https://uipkge.dev/r/react/radio-group.json",
    "https://uipkge.dev/r/react/select.json",
    "https://uipkge.dev/r/react/separator.json",
    "https://uipkge.dev/r/react/textarea.json"
  ],
  "description": "Resident repair and facility work order submission portal with urgency priority and photo dropzone.",
  "categories": [
    "real-estate",
    "hospitality",
    "app",
    "forms"
  ]
}