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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

import { DashboardStats, Issue, Project, Task, Team, User } from "@/types";

export const mockUsers: User[] = [
  {
    id: "u1",
    name: "John Smith",
    email: "john.smith@example.com",
    role: "CEO",
    avatar: "https://ui-avatars.com/api/?name=John+Smith&background=random",
  },
  {
    id: "u2",
    name: "Emily Johnson",
    email: "emily.johnson@example.com",
    role: "COO",
    avatar: "https://ui-avatars.com/api/?name=Emily+Johnson&background=random",
  },
  {
    id: "u3",
    name: "Michael Brown",
    email: "michael.brown@example.com",
    role: "Project Manager",
    avatar: "https://ui-avatars.com/api/?name=Michael+Brown&background=random",
  },
  {
    id: "u4",
    name: "Sarah Davis",
    email: "sarah.davis@example.com",
    role: "Account Manager",
    avatar: "https://ui-avatars.com/api/?name=Sarah+Davis&background=random",
  },
  {
    id: "u5",
    name: "David Wilson",
    email: "david.wilson@example.com",
    role: "Tech Lead",
    avatar: "https://ui-avatars.com/api/?name=David+Wilson&background=random",
  },
  {
    id: "u6",
    name: "Jessica Miller",
    email: "jessica.miller@example.com",
    role: "Senior Developer",
    avatar: "https://ui-avatars.com/api/?name=Jessica+Miller&background=random",
  },
  {
    id: "u7",
    name: "Thomas Moore",
    email: "thomas.moore@example.com",
    role: "Developer",
    avatar: "https://ui-avatars.com/api/?name=Thomas+Moore&background=random",
  },
  {
    id: "u8",
    name: "Patricia Taylor",
    email: "patricia.taylor@example.com",
    role: "Testing Manager",
    avatar: "https://ui-avatars.com/api/?name=Patricia+Taylor&background=random",
  },
  {
    id: "u9",
    name: "Daniel Anderson",
    email: "daniel.anderson@example.com",
    role: "Senior Tester",
    avatar: "https://ui-avatars.com/api/?name=Daniel+Anderson&background=random",
  },
  {
    id: "u10",
    name: "Jennifer Thomas",
    email: "jennifer.thomas@example.com",
    role: "Tester",
    avatar: "https://ui-avatars.com/api/?name=Jennifer+Thomas&background=random",
  },
];

export const mockProjects: Project[] = [
  {
    id: "p1",
    name: "Office Management",
    description: "Office management software development",
    status: "Active",
    progress: 65,
    startDate: "2023-04-01",
    endDate: "2023-07-15",
    teamId: "t1",
    leadId: "u3",
  },
  {
    id: "p2",
    name: "Hospital Administration",
    description: "Hospital administration system",
    status: "Active",
    progress: 40,
    startDate: "2023-04-01",
    endDate: "2023-07-15",
    teamId: "t2",
    leadId: "u3",
  },
  {
    id: "p3",
    name: "Project Management",
    description: "Project management tool development",
    status: "Active",
    progress: 25,
    startDate: "2023-07-01",
    endDate: "2023-10-15",
    teamId: "t3",
    leadId: "u5",
  },
  {
    id: "p4",
    name: "Video Calling App",
    description: "Video conferencing solution",
    status: "Active",
    progress: 15,
    startDate: "2023-08-01",
    endDate: "2023-11-30",
    teamId: "t4",
    leadId: "u5",
  },
  {
    id: "p5",
    name: "Digital Marketplace",
    description: "Online marketplace platform",
    status: "Active",
    progress: 5,
    startDate: "2023-09-01",
    endDate: "2024-01-15",
    teamId: "t5",
    leadId: "u3",
  },
];

export const mockTeams: Team[] = [
  {
    id: "t1",
    name: "Core Development",
    members: ["u3", "u5", "u6", "u7", "u8"],
    leadId: "u5",
    projectIds: ["p1"],
  },
  {
    id: "t2",
    name: "Healthcare Solutions",
    members: ["u3", "u4", "u6", "u9", "u10"],
    leadId: "u4",
    projectIds: ["p2"],
  },
  {
    id: "t3",
    name: "Product Team",
    members: ["u3", "u5", "u7", "u8", "u9"],
    leadId: "u5",
    projectIds: ["p3"],
  },
  {
    id: "t4",
    name: "Communication Tech",
    members: ["u4", "u5", "u6", "u7", "u10"],
    leadId: "u5",
    projectIds: ["p4"],
  },
  {
    id: "t5",
    name: "E-commerce Solutions",
    members: ["u3", "u4", "u6", "u8", "u9"],
    leadId: "u3",
    projectIds: ["p5"],
  },
];

export const mockIssues: Issue[] = [
  {
    id: "i1",
    title: "Login button not working",
    description: "Users cannot login using the login button on the homepage",
    projectId: "p1",
    assigneeId: "u7",
    reporterId: "u8",
    priority: "High",
    status: "In Progress",
    type: "Bug",
    createdAt: "2023-05-10T10:30:00Z",
    updatedAt: "2023-05-10T14:20:00Z",
  },
  {
    id: "i2",
    title: "API timeout",
    description: "The API is timing out when fetching large datasets",
    projectId: "p1",
    assigneeId: "u6",
    reporterId: "u9",
    priority: "Critical",
    status: "In Progress",
    type: "Bug",
    createdAt: "2023-05-11T09:15:00Z",
    updatedAt: "2023-05-11T13:45:00Z",
  },
  {
    id: "i3",
    title: "UI misalign",
    description: "UI elements are misaligned on mobile devices",
    projectId: "p2",
    assigneeId: "u6",
    reporterId: "u9",
    priority: "Medium",
    status: "New",
    type: "Bug",
    createdAt: "2023-05-12T11:20:00Z",
    updatedAt: "2023-05-12T11:20:00Z",
  },
  {
    id: "i4",
    title: "Dark mode support",
    description: "Implement dark mode for better user experience",
    projectId: "p3",
    assigneeId: "u7",
    reporterId: "u5",
    priority: "Low",
    status: "New",
    type: "Feature",
    createdAt: "2023-05-13T14:10:00Z",
    updatedAt: "2023-05-13T14:10:00Z",
  },
  {
    id: "i5",
    title: "Multi-language UI",
    description: "Add support for multiple languages in the UI",
    projectId: "p4",
    assigneeId: "u6",
    reporterId: "u3",
    priority: "Medium",
    status: "New",
    type: "Feature",
    createdAt: "2023-05-14T10:05:00Z",
    updatedAt: "2023-05-14T10:05:00Z",
  },
  {
    id: "i6",
    title: "Notification panel",
    description: "Create a notification panel for real-time updates",
    projectId: "p5",
    assigneeId: "u7",
    reporterId: "u3",
    priority: "Medium",
    status: "New",
    type: "Feature",
    createdAt: "2023-05-15T09:30:00Z",
    updatedAt: "2023-05-15T09:30:00Z",
  },
  {
    id: "i7",
    title: "Advanced search",
    description: "Implement advanced search functionality",
    projectId: "p5",
    assigneeId: "u6",
    reporterId: "u4",
    priority: "Low",
    status: "New",
    type: "Feature",
    createdAt: "2023-05-16T13:45:00Z",
    updatedAt: "2023-05-16T13:45:00Z",
  },
];

export const mockTasks: Task[] = [
  {
    id: "t1",
    title: "Fix login button",
    description: "Investigate and fix login button not working issue",
    issueId: "i1",
    assigneeId: "u7",
    status: "In Progress",
    priority: "High",
    dueDate: "2023-05-17",
    createdAt: "2023-05-10T14:20:00Z",
    updatedAt: "2023-05-10T14:20:00Z",
  },
  {
    id: "t2",
    title: "Optimize API endpoints",
    description: "Improve API performance and fix timeout issues",
    issueId: "i2",
    assigneeId: "u6",
    status: "In Progress",
    priority: "Critical",
    dueDate: "2023-05-18",
    createdAt: "2023-05-11T13:45:00Z",
    updatedAt: "2023-05-11T13:45:00Z",
  },
  {
    id: "t3",
    title: "Responsive design fixes",
    description: "Fix UI misalignment issues on mobile devices",
    issueId: "i3",
    assigneeId: "u6",
    status: "New",
    priority: "Medium",
    dueDate: "2023-05-19",
    createdAt: "2023-05-12T11:20:00Z",
    updatedAt: "2023-05-12T11:20:00Z",
  },
  {
    id: "t4",
    title: "Dark mode implementation",
    description: "Create dark mode theme and toggle",
    issueId: "i4",
    assigneeId: "u7",
    status: "New",
    priority: "Low",
    dueDate: "2023-05-20",
    createdAt: "2023-05-13T14:10:00Z",
    updatedAt: "2023-05-13T14:10:00Z",
  },
  {
    id: "t5",
    title: "UI localization",
    description: "Set up language switcher and translate UI elements",
    issueId: "i5",
    assigneeId: "u6",
    status: "New",
    priority: "Medium",
    dueDate: "2023-05-21",
    createdAt: "2023-05-14T10:05:00Z",
    updatedAt: "2023-05-14T10:05:00Z",
  },
  {
    id: "t6",
    title: "Notification UI design",
    description: "Design notification panel UI components",
    issueId: "i6",
    assigneeId: "u7",
    status: "New",
    priority: "Medium",
    dueDate: "2023-05-22",
    createdAt: "2023-05-15T09:30:00Z",
    updatedAt: "2023-05-15T09:30:00Z",
  },
  {
    id: "t7",
    title: "Search algorithm",
    description: "Develop advanced search algorithm and indexing",
    issueId: "i7",
    assigneeId: "u6",
    status: "New",
    priority: "Low",
    dueDate: "2023-05-23",
    createdAt: "2023-05-16T13:45:00Z",
    updatedAt: "2023-05-16T13:45:00Z",
  },
];

export const mockDashboardStats: DashboardStats = {
  projects: 112,
  employees: 218,
  tasks: 37,
  clients: 44,
  revenue: 142500,
  expenses: 58500,
  profit: 84000,
  completedTasks: 156,
  pendingTasks: 32,
  inProgressTasks: 75,
  onHoldTasks: 21,
  reviewTasks: 5,
};

export const mockRevenueData = [
  { name: "2018", value: 150000, color: "#F97316" },
  { name: "2019", value: 160000, color: "#F97316" },
  { name: "2020", value: 130000, color: "#F97316" },
  { name: "2021", value: 170000, color: "#F97316" },
  { name: "2022", value: 150000, color: "#F97316" },
  { name: "2023", value: 190000, color: "#F97316" },
];

export const mockSalesData = [
  { name: "00:00", value: 50, color: "#E53E3E" },
  { name: "03:00", value: 80, color: "#E53E3E" },
  { name: "06:00", value: 45, color: "#E53E3E" },
  { name: "09:00", value: 60, color: "#E53E3E" },
  { name: "12:00", value: 75, color: "#E53E3E" },
  { name: "15:00", value: 55, color: "#E53E3E" },
  { name: "18:00", value: 70, color: "#E53E3E" },
  { name: "21:00", value: 90, color: "#E53E3E" },
  { name: "00:00", value: 40, color: "#F97316" },
  { name: "03:00", value: 60, color: "#F97316" },
  { name: "06:00", value: 75, color: "#F97316" },
  { name: "09:00", value: 45, color: "#F97316" },
  { name: "12:00", value: 55, color: "#F97316" },
  { name: "15:00", value: 70, color: "#F97316" },
  { name: "18:00", value: 45, color: "#F97316" },
  { name: "21:00", value: 85, color: "#F97316" },
];

export function getUserById(id: string): User | undefined {
  return mockUsers.find(user => user.id === id);
}

export function getProjectById(id: string): Project | undefined {
  return mockProjects.find(project => project.id === id);
}

export function getTeamById(id: string): Team | undefined {
  return mockTeams.find(team => team.id === id);
}

export function getIssueById(id: string): Issue | undefined {
  return mockIssues.find(issue => issue.id === id);
}

export function getTaskById(id: string): Task | undefined {
  return mockTasks.find(task => task.id === id);
}

export function getUsersByTeamId(teamId: string): User[] {
  const team = mockTeams.find(t => t.id === teamId);
  if (!team) return [];
  return team.members.map(userId => getUserById(userId)).filter(Boolean) as User[];
}

export function getProjectsByTeamId(teamId: string): Project[] {
  return mockProjects.filter(project => project.teamId === teamId);
}

export function getIssuesByProjectId(projectId: string): Issue[] {
  return mockIssues.filter(issue => issue.projectId === projectId);
}

export function getTasksByIssueId(issueId: string): Task[] {
  return mockTasks.filter(task => task.issueId === issueId);
}

export function getTasksByAssigneeId(assigneeId: string): Task[] {
  return mockTasks.filter(task => task.assigneeId === assigneeId);
}

export function getProjectsByLeadId(leadId: string): Project[] {
  return mockProjects.filter(project => project.leadId === leadId);
}

export function getTeamsByUserId(userId: string): Team[] {
  return mockTeams.filter(team => team.members.includes(userId));
}