import { Permission, Role } from '../interfaces/role';

export const PERMISSIONS_MOCK: Permission[] = [
  // Users
  { id: 'p1', name: 'USERS_READ', description: 'Voir utilisateurs' },
  { id: 'p2', name: 'USERS_CREATE', description: 'Créer utilisateurs' },
  { id: 'p3', name: 'USERS_UPDATE', description: 'Modifier utilisateurs' },
  { id: 'p4', name: 'USERS_DELETE', description: 'Supprimer utilisateurs' },
  { id: 'p5', name: 'USERS_RESET_PASSWORD', description: 'Réinitialiser mot de passe' },
  { id: 'p6', name: 'USERS_LOCK', description: 'Verrouiller utilisateurs' },
  { id: 'p7', name: 'USERS_UNLOCK', description: 'Déverrouiller utilisateurs' },
  { id: 'p8', name: 'USERS_RESET_2FA', description: 'Réinitialiser 2FA' },
  { id: 'p9', name: 'USERS_CHANGE_ROLE', description: 'Changer de rôle' },
  { id: 'p10', name: 'USERS_CHANGE_STATUS', description: 'Changer de statut' },

  // Hippodromes
  { id: 'p11', name: 'HIPPODROMES_READ', description: 'Voir hippodromes' },
  { id: 'p12', name: 'HIPPODROMES_CREATE', description: 'Créer hippodromes' },
  { id: 'p13', name: 'HIPPODROMES_UPDATE', description: 'Modifier hippodromes' },
  { id: 'p14', name: 'HIPPODROMES_DELETE', description: 'Supprimer hippodromes' },

  // Reunions
  { id: 'p11', name: 'REUNIONS_READ', description: 'Voir reunions' },
  { id: 'p12', name: 'REUNIONS_CREATE', description: 'Créer reunions' },
  { id: 'p13', name: 'REUNIONS_UPDATE', description: 'Modifier reunions' },
  { id: 'p14', name: 'REUNIONS_DELETE', description: 'Supprimer reunions' },
  { id: 'p15', name: 'REUNIONS_PLANIFIEE', description: 'Planifier reunions' },
  { id: 'p17', name: 'REUNIONS_TERMINEE', description: 'Terminer les reunions' },
  { id: 'p18', name: 'REUNIONS_CANCEL', description: 'Annuler les reunions' },

  // Courses
  { id: 'p19', name: 'COURSES_READ', description: 'Voir courses' },
  { id: 'p20', name: 'COURSES_CREATE', description: 'Créer courses' },
  { id: 'p21', name: 'COURSES_UPDATE', description: 'Modifier courses' },
  { id: 'p22', name: 'COURSES_DELETE', description: 'Supprimer courses' },
  { id: 'p23', name: 'COURSES_VALIDATE', description: 'Valider courses' },
  { id: 'p24', name: 'COURSES_CONFIRM', description: 'Confirmer courses' },
  { id: 'p25', name: 'COURSES_CLOSE', description: 'Clôturer courses' },
  { id: 'p26', name: 'COURSES_CANCEL', description: 'Annuler courses' },

  // TPE
  { id: 'p27', name: 'TPE_READ', description: 'Voir TPE' },
  { id: 'p28', name: 'TPE_CREATE', description: 'Créer TPE' },
  { id: 'p29', name: 'TPE_UPDATE', description: 'Modifier TPE' },
  { id: 'p30', name: 'TPE_DELETE', description: 'Supprimer TPE' },
  { id: 'p31', name: 'TPE_ASSIGN', description: 'Assigner TPE' },
  { id: 'p32', name: 'TPE_UNASSIGN', description: 'Déassigner TPE' },

  // Agents
  { id: 'p33', name: 'AGENTS_READ', description: 'Voir agents' },
  { id: 'p34', name: 'AGENTS_CREATE', description: 'Créer agents' },
  { id: 'p35', name: 'AGENTS_UPDATE', description: 'Modifier agents' },
  { id: 'p36', name: 'AGENTS_DELETE', description: 'Supprimer agents' },
  { id: 'p37', name: 'AGENTS_ASSIGN', description: 'Assigner agents' },
  { id: 'p38', name: 'AGENTS_UNASSIGN', description: 'Déassigner agents' },
  { id: 'p39', name: 'AGENTS_ASSIGN_TPE', description: 'Assigner TPE à agents' },
  { id: 'p40', name: 'AGENTS_UNASSIGN_TPE', description: 'Déassigner TPE à agents' },

  // Familles Agents
  { id: 'p41', name: 'AGENT_FAMILIES_READ', description: 'Voir familles agents' },
  { id: 'p42', name: 'AGENT_FAMILIES_CREATE', description: 'Créer familles agents' },
  { id: 'p43', name: 'AGENT_FAMILIES_UPDATE', description: 'Modifier familles agents' },
  { id: 'p44', name: 'AGENT_FAMILIES_DELETE', description: 'Supprimer familles agents' },

  // Limites Agents
  { id: 'p41', name: 'AGENT_LIMITS_READ', description: 'Voir limites agents' },
  { id: 'p42', name: 'AGENT_LIMITS_CREATE', description: 'Créer limites agents' },
  { id: 'p43', name: 'AGENT_LIMITS_UPDATE', description: 'Modifier limites agents' },
  { id: 'p44', name: 'AGENT_LIMITS_DELETE', description: 'Supprimer limites agents' },
  { id: 'p45', name: 'AGENT_LIMITS_DEFAULTED', description: 'Définir limites agents par défaut' },

  // Permissions
  { id: 'p31', name: 'PERMISSIONS_READ', description: 'Voir permissions' },
  { id: 'p32', name: 'PERMISSIONS_CREATE', description: 'Créer permissions' },
  { id: 'p33', name: 'PERMISSIONS_UPDATE', description: 'Modifier permissions' },
  { id: 'p34', name: 'PERMISSIONS_DELETE', description: 'Supprimer permissions' },
  { id: 'p35', name: 'PERMISSIONS_ASSIGN', description: 'Assigner permissions' },
  { id: 'p36', name: 'PERMISSIONS_UNASSIGN', description: 'Déassigner permissions' },

  // Roles
  { id: 'p37', name: 'ROLES_READ', description: 'Voir rôles' },
  { id: 'p38', name: 'ROLES_CREATE', description: 'Créer rôles' },
  { id: 'p39', name: 'ROLES_UPDATE', description: 'Modifier rôles' },
  { id: 'p40', name: 'ROLES_DELETE', description: 'Supprimer rôles' },
  { id: 'p41', name: 'ROLES_ASSIGN', description: 'Assigner rôles' },
  { id: 'p42', name: 'ROLES_UNASSIGN', description: 'Déassigner rôles' },
  { id: 'p43', name: 'ROLES_ASSIGN_PERMISSIONS', description: 'Assigner permissions à rôles' },
  { id: 'p44', name: 'ROLES_UNASSIGN_PERMISSIONS', description: 'Déassigner permissions à rôles' },

  // Users
  { id: 'p45', name: 'USERS_READ', description: 'Voir utilisateurs' },
  { id: 'p46', name: 'USERS_CREATE', description: 'Créer utilisateurs' },
  { id: 'p47', name: 'USERS_UPDATE', description: 'Modifier utilisateurs' },
  { id: 'p48', name: 'USERS_DELETE', description: 'Supprimer utilisateurs' },
  { id: 'p49', name: 'USERS_RESET_PASSWORD', description: 'Réinitialiser mot de passe' },
  { id: 'p50', name: 'USERS_LOCK', description: 'Verrouiller utilisateurs' },
  { id: 'p51', name: 'USERS_UNLOCK', description: 'Déverrouiller utilisateurs' },
];

export const ROLES_MOCK: Role[] = [
  {
    id: crypto.randomUUID(),
    name: 'Superadmin',
    description: 'Accès total à toute la plateforme',
    permissions: [...PERMISSIONS_MOCK],
    createdAt: new Date().toISOString(),
  },
  {
    id: crypto.randomUUID(),
    name: 'Administrateur Hippique',
    description: 'Gestion des courses et résultats',
    permissions: PERMISSIONS_MOCK.filter((p) =>
      [
        'COURSES_READ',
        'COURSES_MANAGE',
        'RESULTATS_VALIDATE',
        'RESULTATS_CONFIRM',
        'USERS_READ',
      ].includes(p.name)
    ),
    createdAt: new Date().toISOString(),
  },
  {
    id: crypto.randomUUID(),
    name: 'Agent Commercial',
    description: 'Gestion commerciale',
    permissions: PERMISSIONS_MOCK.filter((p) => ['USERS_READ', 'COURSES_READ'].includes(p.name)),
    createdAt: new Date().toISOString(),
  },
  {
    id: crypto.randomUUID(),
    name: 'Gestionnaires Réseau',
    description: 'Gestion du réseau et consultation',
    permissions: PERMISSIONS_MOCK.filter((p) => ['USERS_READ', 'COURSES_READ'].includes(p.name)),
    createdAt: new Date().toISOString(),
  },
  {
    id: crypto.randomUUID(),
    name: 'Support PJP',
    description: 'Support et consultation',
    permissions: PERMISSIONS_MOCK.filter((p) => ['USERS_READ', 'COURSES_READ'].includes(p.name)),
    createdAt: new Date().toISOString(),
  },
];
