import type { Product } from '@/features/products/api/types';
import type { User } from '@/features/users/api/types';

function imageFor(name: string, accent: string) {
  return `https://placehold.co/120x120/${accent}/ffffff/png?text=${encodeURIComponent(name.slice(0, 12))}`;
}

const now = '2026-06-07T00:00:00.000Z';

export const exampleProducts: Product[] = [
  {
    id: 1,
    organization_id: 'example-org',
    photo_url: imageFor('Asset Portal', '1b4332'),
    name: 'Asset Portal',
    description:
      'Starter module showing a route-handler-backed listing with filters and pagination.',
    created_at: now,
    price: 1290,
    category: 'Electronics',
    updated_at: now
  },
  {
    id: 2,
    organization_id: 'example-org',
    photo_url: imageFor('Ops Console', '2d6a4f'),
    name: 'Ops Console',
    description: 'Admin surface for approvals, task queues, and role-sensitive workflows.',
    created_at: now,
    price: 980,
    category: 'Books',
    updated_at: now
  },
  {
    id: 3,
    organization_id: 'example-org',
    photo_url: imageFor('Workspace Kit', '40916c'),
    name: 'Workspace Kit',
    description: 'Multi-tenant UI pattern package for organization switching and scoped data.',
    created_at: now,
    price: 1420,
    category: 'Furniture',
    updated_at: now
  },
  {
    id: 4,
    organization_id: 'example-org',
    photo_url: imageFor('Sales Pulse', '52796f'),
    name: 'Sales Pulse',
    description: 'Overview widgets and charts demonstrating KPI storytelling in a dashboard shell.',
    created_at: now,
    price: 760,
    category: 'Beauty Products',
    updated_at: now
  },
  {
    id: 5,
    organization_id: 'example-org',
    photo_url: imageFor('Field Notes', '606c38'),
    name: 'Field Notes',
    description: 'Lightweight operational recordkeeping page used to showcase table composition.',
    created_at: now,
    price: 240,
    category: 'Books',
    updated_at: now
  },
  {
    id: 6,
    organization_id: 'example-org',
    photo_url: imageFor('Checkout Sync', '283618'),
    name: 'Checkout Sync',
    description: 'Feature example for queue-based updates and cache invalidation patterns.',
    created_at: now,
    price: 1120,
    category: 'Electronics',
    updated_at: now
  },
  {
    id: 7,
    organization_id: 'example-org',
    photo_url: imageFor('Catalog Lens', 'bc6c25'),
    name: 'Catalog Lens',
    description: 'Search-oriented admin view ideal for practicing server-prefetch and filtering.',
    created_at: now,
    price: 640,
    category: 'Clothing',
    updated_at: now
  },
  {
    id: 8,
    organization_id: 'example-org',
    photo_url: imageFor('Support Desk', 'dda15e'),
    name: 'Support Desk',
    description: 'Internal tooling example for queues, ownership, and operational auditability.',
    created_at: now,
    price: 880,
    category: 'Toys',
    updated_at: now
  },
  {
    id: 9,
    organization_id: 'example-org',
    photo_url: imageFor('Client Ledger', '9c6644'),
    name: 'Client Ledger',
    description: 'Demonstrates data-heavy pages where columns, sorting, and filters matter.',
    created_at: now,
    price: 1540,
    category: 'Jewelry',
    updated_at: now
  },
  {
    id: 10,
    organization_id: 'example-org',
    photo_url: imageFor('Daily Brief', '582f0e'),
    name: 'Daily Brief',
    description: 'Small, opinionated module for daily metrics and recent changes.',
    created_at: now,
    price: 430,
    category: 'Groceries',
    updated_at: now
  },
  {
    id: 11,
    organization_id: 'example-org',
    photo_url: imageFor('Warehouse Pad', '7f4f24'),
    name: 'Warehouse Pad',
    description: 'Inventory-oriented sample used to show category filtering in the template.',
    created_at: now,
    price: 1180,
    category: 'Furniture',
    updated_at: now
  },
  {
    id: 12,
    organization_id: 'example-org',
    photo_url: imageFor('Pulse Board', '6f1d1b'),
    name: 'Pulse Board',
    description: 'A concise management view for experimenting with table state and URL sync.',
    created_at: now,
    price: 990,
    category: 'Electronics',
    updated_at: now
  }
];

export const exampleUsers: User[] = [
  {
    id: 'user-1',
    name: 'Mina Parker',
    email: 'mina@example.com',
    systemRole: 'super_admin',
    activeMembershipRole: 'admin',
    activeOrganizationId: 'org-atlas',
    organizations: [
      { id: 'org-atlas', name: 'Atlas Labs', role: 'admin' },
      { id: 'org-nova', name: 'Nova Retail', role: 'admin' }
    ],
    memberships: [
      {
        organizationId: 'org-atlas',
        organizationName: 'Atlas Labs',
        membershipRole: 'admin',
        businessRole: 'sales_manager'
      },
      {
        organizationId: 'org-nova',
        organizationName: 'Nova Retail',
        membershipRole: 'admin',
        businessRole: 'department_manager'
      }
    ]
  },
  {
    id: 'user-2',
    name: 'Noah Bennett',
    email: 'noah@example.com',
    systemRole: 'user',
    activeMembershipRole: 'admin',
    activeOrganizationId: 'org-atlas',
    organizations: [{ id: 'org-atlas', name: 'Atlas Labs', role: 'admin' }],
    memberships: [
      {
        organizationId: 'org-atlas',
        organizationName: 'Atlas Labs',
        membershipRole: 'admin',
        businessRole: 'sales_manager'
      }
    ]
  },
  {
    id: 'user-3',
    name: 'Lina Torres',
    email: 'lina@example.com',
    systemRole: 'user',
    activeMembershipRole: 'user',
    activeOrganizationId: 'org-atlas',
    organizations: [{ id: 'org-atlas', name: 'Atlas Labs', role: 'user' }],
    memberships: [
      {
        organizationId: 'org-atlas',
        organizationName: 'Atlas Labs',
        membershipRole: 'user',
        businessRole: 'sales'
      }
    ]
  },
  {
    id: 'user-4',
    name: 'Kai Morgan',
    email: 'kai@example.com',
    systemRole: 'user',
    activeMembershipRole: 'admin',
    activeOrganizationId: 'org-nova',
    organizations: [{ id: 'org-nova', name: 'Nova Retail', role: 'admin' }],
    memberships: [
      {
        organizationId: 'org-nova',
        organizationName: 'Nova Retail',
        membershipRole: 'admin',
        businessRole: 'department_manager'
      }
    ]
  },
  {
    id: 'user-5',
    name: 'Pim Srisuk',
    email: 'pim@example.com',
    systemRole: 'user',
    activeMembershipRole: 'user',
    activeOrganizationId: 'org-nova',
    organizations: [{ id: 'org-nova', name: 'Nova Retail', role: 'user' }],
    memberships: [
      {
        organizationId: 'org-nova',
        organizationName: 'Nova Retail',
        membershipRole: 'user',
        businessRole: 'sales_support'
      }
    ]
  },
  {
    id: 'user-6',
    name: 'Sara Kim',
    email: 'sara@example.com',
    systemRole: 'user',
    activeMembershipRole: 'user',
    activeOrganizationId: 'org-orbit',
    organizations: [{ id: 'org-orbit', name: 'Orbit Health', role: 'user' }],
    memberships: [
      {
        organizationId: 'org-orbit',
        organizationName: 'Orbit Health',
        membershipRole: 'user',
        businessRole: 'top_manager'
      }
    ]
  },
  {
    id: 'user-7',
    name: 'Theo Walsh',
    email: 'theo@example.com',
    systemRole: 'user',
    activeMembershipRole: 'admin',
    activeOrganizationId: 'org-orbit',
    organizations: [{ id: 'org-orbit', name: 'Orbit Health', role: 'admin' }],
    memberships: [
      {
        organizationId: 'org-orbit',
        organizationName: 'Orbit Health',
        membershipRole: 'admin',
        businessRole: 'sales_manager'
      }
    ]
  },
  {
    id: 'user-8',
    name: 'Mew Lert',
    email: 'mew@example.com',
    systemRole: 'user',
    activeMembershipRole: 'user',
    activeOrganizationId: 'org-atlas',
    organizations: [
      { id: 'org-atlas', name: 'Atlas Labs', role: 'user' },
      { id: 'org-orbit', name: 'Orbit Health', role: 'user' }
    ],
    memberships: [
      {
        organizationId: 'org-atlas',
        organizationName: 'Atlas Labs',
        membershipRole: 'user',
        businessRole: 'sales_support'
      },
      {
        organizationId: 'org-orbit',
        organizationName: 'Orbit Health',
        membershipRole: 'user',
        businessRole: 'sales'
      }
    ]
  }
];
