All files / src/lib/api-docs/endpoints/admin support.ts

100% Statements 797/797
100% Branches 0/0
100% Functions 0/0
100% Lines 797/797

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 7981x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 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 * Support tickets, agents, articles, and FAQ management
 */
 
import type { ApiEndpoint } from '@/types/api-docs';
 
export const adminSupportEndpoints: ApiEndpoint[] = [
  // Support Dashboard
  {
    id: 'admin-support-dashboard',
    method: 'GET',
    path: '/api/admin/support/dashboard',
    summary: 'Get support dashboard',
    description: 'Returns support metrics, open tickets, and agent performance',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    responses: [
      {
        status: 200,
        description: 'Support dashboard data',
        example: {
          success: true,
          data: {
            openTickets: 45,
            avgResponseTime: '2h 30m',
            customerSatisfaction: 4.5,
            ticketsByStatus: { open: 45, inProgress: 30, resolved: 120 },
          },
        },
      },
      { status: 403, description: 'Admin access required' },
    ],
  },
  // Tickets Management
  {
    id: 'admin-support-tickets-list',
    method: 'GET',
    path: '/api/admin/support/tickets',
    summary: 'List all tickets',
    description: 'Returns paginated list of all support tickets',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'page', type: 'number', required: false, location: 'query', description: 'Page number' },
      { name: 'limit', type: 'number', required: false, location: 'query', description: 'Items per page' },
      { name: 'status', type: 'string', required: false, location: 'query', description: 'Filter by status' },
      { name: 'priority', type: 'string', required: false, location: 'query', description: 'Filter by priority' },
      { name: 'assignedTo', type: 'number', required: false, location: 'query', description: 'Filter by agent ID' },
      { name: 'category', type: 'string', required: false, location: 'query', description: 'Filter by category' },
    ],
    responses: [
      { status: 200, description: 'List of tickets' },
      { status: 403, description: 'Admin access required' },
    ],
  },
  {
    id: 'admin-support-tickets-get',
    method: 'GET',
    path: '/api/admin/support/tickets/{id}',
    summary: 'Get ticket details',
    description: 'Returns full ticket details with messages and audit log',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'string', required: true, location: 'path', description: 'Ticket ID' },
    ],
    responses: [
      { status: 200, description: 'Ticket details with messages' },
      { status: 404, description: 'Ticket not found' },
    ],
  },
  {
    id: 'admin-support-tickets-update',
    method: 'PATCH',
    path: '/api/admin/support/tickets/{id}',
    summary: 'Update ticket',
    description: 'Updates ticket status, priority, or assignment',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'string', required: true, location: 'path', description: 'Ticket ID' },
    ],
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'status', type: 'string', required: false, description: 'Ticket status', enum: ['OPEN', 'IN_PROGRESS', 'WAITING', 'RESOLVED', 'CLOSED'] },
        { name: 'priority', type: 'string', required: false, description: 'Priority level', enum: ['LOW', 'MEDIUM', 'HIGH', 'URGENT'] },
        { name: 'assignedAgentId', type: 'number', required: false, description: 'Agent ID to assign' },
        { name: 'category', type: 'string', required: false, description: 'Ticket category' },
        { name: 'internalNotes', type: 'string', required: false, description: 'Internal notes' },
      ],
    },
    responses: [
      { status: 200, description: 'Ticket updated' },
      { status: 404, description: 'Ticket not found' },
    ],
  },
  {
    id: 'admin-support-tickets-reply',
    method: 'POST',
    path: '/api/admin/support/tickets/{id}/reply',
    summary: 'Reply to ticket',
    description: 'Adds an agent reply to a ticket',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'string', required: true, location: 'path', description: 'Ticket ID' },
    ],
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'content', type: 'string', required: true, description: 'Reply content' },
        { name: 'isInternal', type: 'boolean', required: false, description: 'Internal note (not visible to customer)' },
      ],
    },
    responses: [
      { status: 201, description: 'Reply added' },
      { status: 404, description: 'Ticket not found' },
    ],
  },
  {
    id: 'admin-support-tickets-assign',
    method: 'POST',
    path: '/api/admin/support/tickets/{id}/assign',
    summary: 'Assign ticket',
    description: 'Assigns a ticket to an agent',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'string', required: true, location: 'path', description: 'Ticket ID' },
    ],
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'agentId', type: 'number', required: true, description: 'Agent ID to assign' },
      ],
    },
    responses: [
      { status: 200, description: 'Ticket assigned' },
      { status: 404, description: 'Ticket or agent not found' },
    ],
  },
  {
    id: 'admin-support-tickets-resolve',
    method: 'POST',
    path: '/api/admin/support/tickets/{id}/resolve',
    summary: 'Resolve ticket',
    description: 'Marks a ticket as resolved',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'string', required: true, location: 'path', description: 'Ticket ID' },
    ],
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'resolution', type: 'string', required: false, description: 'Resolution summary' },
      ],
    },
    responses: [
      { status: 200, description: 'Ticket resolved' },
      { status: 404, description: 'Ticket not found' },
    ],
  },
  // Agents Management
  {
    id: 'admin-support-agents-list',
    method: 'GET',
    path: '/api/admin/support/agents',
    summary: 'List support agents',
    description: 'Returns list of support agents with performance metrics',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    responses: [
      { status: 200, description: 'List of agents' },
    ],
  },
  {
    id: 'admin-support-agents-create',
    method: 'POST',
    path: '/api/admin/support/agents',
    summary: 'Add support agent',
    description: 'Adds a user as a support agent',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'userId', type: 'number', required: true, description: 'User ID to add as agent' },
        { name: 'role', type: 'string', required: false, description: 'Agent role', enum: ['AGENT', 'SUPERVISOR', 'MANAGER'] },
        { name: 'maxTickets', type: 'number', required: false, description: 'Max concurrent tickets' },
      ],
    },
    responses: [
      { status: 201, description: 'Agent added' },
      { status: 400, description: 'User already an agent' },
      { status: 404, description: 'User not found' },
    ],
  },
  {
    id: 'admin-support-agents-get',
    method: 'GET',
    path: '/api/admin/support/agents/{id}',
    summary: 'Get agent details',
    description: 'Returns agent details with performance stats',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'number', required: true, location: 'path', description: 'Agent ID' },
    ],
    responses: [
      { status: 200, description: 'Agent details' },
      { status: 404, description: 'Agent not found' },
    ],
  },
  {
    id: 'admin-support-agents-update',
    method: 'PATCH',
    path: '/api/admin/support/agents/{id}',
    summary: 'Update agent',
    description: 'Updates agent settings',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'number', required: true, location: 'path', description: 'Agent ID' },
    ],
    responses: [
      { status: 200, description: 'Agent updated' },
      { status: 404, description: 'Agent not found' },
    ],
  },
  {
    id: 'admin-support-agents-delete',
    method: 'DELETE',
    path: '/api/admin/support/agents/{id}',
    summary: 'Remove agent',
    description: 'Removes a user from support agents',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'number', required: true, location: 'path', description: 'Agent ID' },
    ],
    responses: [
      { status: 200, description: 'Agent removed' },
      { status: 400, description: 'Agent has open tickets' },
      { status: 404, description: 'Agent not found' },
    ],
  },
  // Articles Management
  {
    id: 'admin-support-articles-list',
    method: 'GET',
    path: '/api/admin/support/articles',
    summary: 'List articles (admin)',
    description: 'Returns all support articles including drafts',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'page', type: 'number', required: false, location: 'query', description: 'Page number' },
      { name: 'limit', type: 'number', required: false, location: 'query', description: 'Items per page' },
      { name: 'status', type: 'string', required: false, location: 'query', description: 'Filter by status', enum: ['draft', 'published', 'archived'] },
    ],
    responses: [
      { status: 200, description: 'List of articles' },
    ],
  },
  {
    id: 'admin-support-articles-create',
    method: 'POST',
    path: '/api/admin/support/articles',
    summary: 'Create article',
    description: 'Creates a new support article',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'title', type: 'string', required: true, description: 'Article title' },
        { name: 'content', type: 'string', required: true, description: 'Article content (HTML/Markdown)' },
        { name: 'category', type: 'string', required: true, description: 'Article category' },
        { name: 'status', type: 'string', required: false, description: 'Article status', enum: ['draft', 'published'] },
        { name: 'tags', type: 'array', required: false, description: 'Array of tags' },
      ],
    },
    responses: [
      { status: 201, description: 'Article created' },
      { status: 400, description: 'Validation failed' },
    ],
  },
  {
    id: 'admin-support-articles-get',
    method: 'GET',
    path: '/api/admin/support/articles/{id}',
    summary: 'Get article (admin)',
    description: 'Returns article with edit history and analytics',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'number', required: true, location: 'path', description: 'Article ID' },
    ],
    responses: [
      { status: 200, description: 'Article details' },
      { status: 404, description: 'Article not found' },
    ],
  },
  {
    id: 'admin-support-articles-update',
    method: 'PUT',
    path: '/api/admin/support/articles/{id}',
    summary: 'Update article',
    description: 'Updates an existing support article',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'number', required: true, location: 'path', description: 'Article ID' },
    ],
    responses: [
      { status: 200, description: 'Article updated' },
      { status: 404, description: 'Article not found' },
    ],
  },
  {
    id: 'admin-support-articles-delete',
    method: 'DELETE',
    path: '/api/admin/support/articles/{id}',
    summary: 'Delete article',
    description: 'Deletes a support article',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'number', required: true, location: 'path', description: 'Article ID' },
    ],
    responses: [
      { status: 200, description: 'Article deleted' },
      { status: 404, description: 'Article not found' },
    ],
  },
  // FAQ Management
  {
    id: 'admin-support-faq-list',
    method: 'GET',
    path: '/api/admin/support/faq',
    summary: 'List FAQ entries',
    description: 'Returns all FAQ entries',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    responses: [
      { status: 200, description: 'List of FAQ entries' },
    ],
  },
  {
    id: 'admin-support-faq-create',
    method: 'POST',
    path: '/api/admin/support/faq',
    summary: 'Create FAQ entry',
    description: 'Creates a new FAQ entry',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'question', type: 'string', required: true, description: 'FAQ question' },
        { name: 'answer', type: 'string', required: true, description: 'FAQ answer' },
        { name: 'category', type: 'string', required: false, description: 'FAQ category' },
        { name: 'order', type: 'number', required: false, description: 'Display order' },
      ],
    },
    responses: [
      { status: 201, description: 'FAQ created' },
      { status: 400, description: 'Validation failed' },
    ],
  },
  {
    id: 'admin-support-faq-update',
    method: 'PUT',
    path: '/api/admin/support/faq/{id}',
    summary: 'Update FAQ entry',
    description: 'Updates an existing FAQ entry',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'number', required: true, location: 'path', description: 'FAQ ID' },
    ],
    responses: [
      { status: 200, description: 'FAQ updated' },
      { status: 404, description: 'FAQ not found' },
    ],
  },
  {
    id: 'admin-support-faq-delete',
    method: 'DELETE',
    path: '/api/admin/support/faq/{id}',
    summary: 'Delete FAQ entry',
    description: 'Deletes a FAQ entry',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'number', required: true, location: 'path', description: 'FAQ ID' },
    ],
    responses: [
      { status: 200, description: 'FAQ deleted' },
      { status: 404, description: 'FAQ not found' },
    ],
  },
  // Canned Responses
  {
    id: 'admin-support-canned-responses-list',
    method: 'GET',
    path: '/api/admin/support/canned-responses',
    summary: 'List canned responses',
    description: 'Returns all canned responses for quick replies',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    responses: [
      { status: 200, description: 'List of canned responses' },
    ],
  },
  {
    id: 'admin-support-canned-responses-create',
    method: 'POST',
    path: '/api/admin/support/canned-responses',
    summary: 'Create canned response',
    description: 'Creates a new canned response template',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'title', type: 'string', required: true, description: 'Response title' },
        { name: 'content', type: 'string', required: true, description: 'Response content' },
        { name: 'category', type: 'string', required: false, description: 'Response category' },
        { name: 'shortcut', type: 'string', required: false, description: 'Keyboard shortcut' },
      ],
    },
    responses: [
      { status: 201, description: 'Canned response created' },
      { status: 400, description: 'Validation failed' },
    ],
  },
  {
    id: 'admin-support-canned-responses-get',
    method: 'GET',
    path: '/api/admin/support/canned-responses/{id}',
    summary: 'Get canned response',
    description: 'Returns a single canned response by ID',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'number', required: true, location: 'path', description: 'Canned response ID' },
    ],
    responses: [
      { status: 200, description: 'Canned response details' },
      { status: 404, description: 'Canned response not found' },
    ],
  },
  {
    id: 'admin-support-canned-responses-update',
    method: 'PUT',
    path: '/api/admin/support/canned-responses/{id}',
    summary: 'Update canned response',
    description: 'Updates an existing canned response',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'number', required: true, location: 'path', description: 'Canned response ID' },
    ],
    responses: [
      { status: 200, description: 'Canned response updated' },
      { status: 404, description: 'Canned response not found' },
    ],
  },
  {
    id: 'admin-support-canned-responses-delete',
    method: 'DELETE',
    path: '/api/admin/support/canned-responses/{id}',
    summary: 'Delete canned response',
    description: 'Deletes a canned response',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'number', required: true, location: 'path', description: 'Canned response ID' },
    ],
    responses: [
      { status: 200, description: 'Canned response deleted' },
      { status: 404, description: 'Canned response not found' },
    ],
  },
  // Support Stats
  {
    id: 'admin-support-stats',
    method: 'GET',
    path: '/api/admin/support/stats',
    summary: 'Get support stats',
    description: 'Returns real-time support statistics and metrics',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'startDate', type: 'string', required: false, location: 'query', description: 'Start date' },
      { name: 'endDate', type: 'string', required: false, location: 'query', description: 'End date' },
    ],
    responses: [
      {
        status: 200,
        description: 'Support statistics',
        example: {
          success: true,
          data: {
            openTickets: 45,
            inProgressTickets: 30,
            resolvedToday: 25,
            avgResponseTime: '1h 45m',
            avgResolutionTime: '4h 20m',
            customerSatisfaction: 4.5,
          },
        },
      },
    ],
  },
  // Ticket Messages
  {
    id: 'admin-support-tickets-messages',
    method: 'GET',
    path: '/api/admin/support/tickets/{id}/messages',
    summary: 'Get ticket messages',
    description: 'Returns all messages for a specific ticket',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'string', required: true, location: 'path', description: 'Ticket ID' },
    ],
    responses: [
      { status: 200, description: 'List of ticket messages' },
      { status: 404, description: 'Ticket not found' },
    ],
  },
  {
    id: 'admin-support-tickets-messages-add',
    method: 'POST',
    path: '/api/admin/support/tickets/{id}/messages',
    summary: 'Add ticket message',
    description: 'Adds a message to a ticket thread',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'string', required: true, location: 'path', description: 'Ticket ID' },
    ],
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'content', type: 'string', required: true, description: 'Message content' },
        { name: 'isInternal', type: 'boolean', required: false, description: 'Internal note (not visible to customer)' },
        { name: 'attachments', type: 'array', required: false, description: 'File attachments' },
      ],
    },
    responses: [
      { status: 201, description: 'Message added' },
      { status: 404, description: 'Ticket not found' },
    ],
  },
  // Bulk Ticket Operations
  {
    id: 'admin-support-tickets-bulk',
    method: 'POST',
    path: '/api/admin/support/tickets/bulk',
    summary: 'Bulk ticket operations',
    description: 'Performs bulk operations on multiple tickets',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'ticketIds', type: 'array', required: true, description: 'Array of ticket IDs' },
        { name: 'action', type: 'string', required: true, description: 'Bulk action', enum: ['assign', 'close', 'change_priority', 'change_status'] },
        { name: 'data', type: 'object', required: false, description: 'Action-specific data (e.g., agentId, status, priority)' },
      ],
    },
    responses: [
      { status: 200, description: 'Bulk operation completed', example: { success: true, data: { updated: 5, failed: 0 } } },
      { status: 400, description: 'Invalid action or ticket IDs' },
    ],
  },
  // Support Reports
  {
    id: 'admin-support-reports',
    method: 'GET',
    path: '/api/admin/support/reports',
    summary: 'Get support reports',
    description: 'Returns aggregated support metrics and trends',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'startDate', type: 'string', required: false, location: 'query', description: 'Start date' },
      { name: 'endDate', type: 'string', required: false, location: 'query', description: 'End date' },
    ],
    responses: [
      { status: 200, description: 'Support reports data' },
    ],
  },
  // Live Chat Management
  {
    id: 'admin-support-chat-conversations-list',
    method: 'GET',
    path: '/api/admin/support/chat/conversations',
    summary: 'List chat conversations',
    description: 'Returns all live chat conversations for agents',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'status', type: 'string', required: false, location: 'query', description: 'Filter by status', enum: ['WAITING', 'ACTIVE', 'ON_HOLD', 'RESOLVED', 'CLOSED'] },
      { name: 'agentId', type: 'number', required: false, location: 'query', description: 'Filter by agent' },
      { name: 'page', type: 'number', required: false, location: 'query', description: 'Page number' },
      { name: 'limit', type: 'number', required: false, location: 'query', description: 'Items per page' },
    ],
    responses: [
      {
        status: 200,
        description: 'List of conversations with queue stats',
        example: {
          success: true,
          data: {
            conversations: [],
            stats: { waiting: 5, active: 10, onHold: 2, myActive: 3 },
          },
        },
      },
    ],
  },
  {
    id: 'admin-support-chat-conversation-get',
    method: 'GET',
    path: '/api/admin/support/chat/{conversationId}',
    summary: 'Get chat conversation with context',
    description: 'Returns conversation with full customer context for agents',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'conversationId', type: 'string', required: true, location: 'path', description: 'Conversation ID' },
    ],
    responses: [
      { status: 200, description: 'Conversation with messages and customer context' },
      { status: 404, description: 'Conversation not found' },
    ],
  },
  {
    id: 'admin-support-chat-conversation-update',
    method: 'PATCH',
    path: '/api/admin/support/chat/{conversationId}',
    summary: 'Update chat conversation',
    description: 'Assign, resolve, close, transfer, or update priority of a conversation',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'conversationId', type: 'string', required: true, location: 'path', description: 'Conversation ID' },
    ],
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'action', type: 'string', required: true, description: 'Action to perform', enum: ['assign', 'resolve', 'close', 'hold', 'transfer', 'priority'] },
        { name: 'resolution', type: 'string', required: false, description: 'Resolution note (for resolve action)' },
        { name: 'reason', type: 'string', required: false, description: 'Reason (for hold/transfer actions)' },
        { name: 'toAgentId', type: 'number', required: false, description: 'Target agent ID (for transfer action)' },
        { name: 'priority', type: 'number', required: false, description: 'Priority 0-3 (for priority action)' },
        { name: 'tags', type: 'array', required: false, description: 'Tags to add' },
      ],
      example: { action: 'assign' },
    },
    responses: [
      { status: 200, description: 'Conversation updated' },
      { status: 400, description: 'Invalid action' },
      { status: 404, description: 'Conversation not found' },
    ],
  },
  {
    id: 'admin-support-chat-conversation-message',
    method: 'POST',
    path: '/api/admin/support/chat/{conversationId}',
    summary: 'Send agent message',
    description: 'Send a message as an agent in a chat conversation',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'conversationId', type: 'string', required: true, location: 'path', description: 'Conversation ID' },
    ],
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'content', type: 'string', required: true, description: 'Message content' },
        { name: 'contentType', type: 'string', required: false, description: 'Content type', enum: ['TEXT', 'IMAGE', 'FILE', 'PRODUCT_CARD', 'ORDER_CARD', 'QUICK_REPLIES'] },
        { name: 'attachments', type: 'array', required: false, description: 'Attachments' },
      ],
      example: { content: 'How can I help you today?' },
    },
    responses: [
      { status: 200, description: 'Message sent' },
      { status: 404, description: 'Conversation not found' },
    ],
  },
  {
    id: 'admin-support-chat-stats',
    method: 'GET',
    path: '/api/admin/support/chat/conversations/stats',
    summary: 'Get chat queue stats',
    description: 'Returns real-time chat queue statistics for agents',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    responses: [
      {
        status: 200,
        description: 'Queue statistics',
        example: {
          success: true,
          data: {
            waiting: 5,
            active: 10,
            onHold: 2,
            myActive: 3,
          },
        },
      },
    ],
  },
  {
    id: 'admin-support-analytics',
    method: 'GET',
    path: '/api/admin/support/analytics',
    summary: 'Get support analytics',
    description: 'Returns comprehensive support analytics including chat metrics, agent performance, and trends',
    category: 'admin-support',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'period', type: 'string', required: false, location: 'query', description: 'Time period', enum: ['7d', '30d', '90d', 'custom'] },
      { name: 'start', type: 'string', required: false, location: 'query', description: 'Start date (ISO format, for custom period)' },
      { name: 'end', type: 'string', required: false, location: 'query', description: 'End date (ISO format, for custom period)' },
    ],
    responses: [
      {
        status: 200,
        description: 'Support analytics summary',
        example: {
          success: true,
          data: {
            period: { startDate: '2025-01-01', endDate: '2025-01-07' },
            chat: {
              totalConversations: 150,
              resolvedConversations: 120,
              averageResponseTime: 180,
              averageHandleTime: 900,
              averageRating: 4.5,
            },
            topAgents: [],
            dailyTrend: [],
            busiestHours: [],
            topTags: [],
          },
        },
      },
    ],
  },
];