import { User } from "@/model/User";
import { IUserService } from "./user.service.interface";

export class UserStubService implements IUserService {
  private readonly users: User[] = [
    new User({
      name: "Alice",
      age: 28,
      height: 165,
      weight: 58,
      sexe: false,
      logo: "alice.png",
      nbSessionPerWeek: 3,
      goal: "Perdre du poids",
      healthProblems: [],
      sport: "YOGA",
      sleepLevel: "GOOD",
      sportLevel: "BEGINNER",
      email: "test@1.com",
      password: "password1",
    }),
    new User({
      email: "test@2.com",
      password: "password2",
    }),
    new User({
      name: "Charlie",
      age: 22,
      height: 172,
      weight: 70,
      sexe: true,
      logo: "charlie.png",
      nbSessionPerWeek: 2,
      goal: "Se remettre en forme",
      healthProblems: [],
      sport: "BIKING",
      sleepLevel: "GOOD",
      sportLevel: "BEGINNER",
      email: "test@3.com",
      password: "password3",
    }),
    new User({
      name: "Diana",
      age: 31,
      height: 160,
      weight: 55,
      sexe: false,
      logo: "diana.png",
      nbSessionPerWeek: 5,
      goal: "Préparer un marathon",
      healthProblems: [],
      sport: "RUNNING",
      sleepLevel: "GOOD",
      sportLevel: "VERY_SPORTY",
      email: "test@4.com",
      password: "password4",
    }),
    new User({
      name: "Ethan",
      age: 40,
      height: 180,
      weight: 88,
      sexe: true,
      logo: "ethan.png",
      nbSessionPerWeek: 1,
      goal: "Maintenir sa forme",
      healthProblems: ["MIGRAINE"],
      sport: "WALKING",
      sleepLevel: "BAD",
      sportLevel: "SPORTY",
      email: "test@5.com",
      password: "password5",
    }),
    new User({
      name: "Fiona",
      age: 26,
      height: 167,
      weight: 62,
      sexe: false,
      logo: "fiona.png",
      nbSessionPerWeek: 3,
      goal: "Renforcer le dos",
      healthProblems: ["MIGRAINE"],
      sport: "CARDIO",
      sleepLevel: "BAD",
      sportLevel: "BEGINNER",
      email: "test@6.com",
      password: "password6",
    }),
    new User({
      name: "George",
      age: 30,
      height: 185,
      weight: 90,
      sexe: true,
      logo: "george.png",
      nbSessionPerWeek: 4,
      goal: "Perdre du gras",
      healthProblems: [],
      sport: "BIKING",
      sleepLevel: "TERRIBLE",
      sportLevel: "SPORTY",
      email: "test@7.com",
      password: "password7",
    }),
    new User({
      name: "Hanna",
      age: 24,
      height: 158,
      weight: 54,
      sexe: false,
      logo: "hanna.png",
      nbSessionPerWeek: 2,
      goal: "Se tonifier",
      healthProblems: [],
      sport: "RANDO",
      sleepLevel: "GOOD",
      sportLevel: "BEGINNER",
      email: "test@8.com",
      password: "password8",
    }),
    new User({
      name: "Ivan",
      age: 50,
      height: 175,
      weight: 95,
      sexe: true,
      logo: "ivan.png",
      nbSessionPerWeek: 1,
      goal: "Rééducation",
      healthProblems: ["ARTHROSE"],
      sport: "WALKING",
      sleepLevel: "BAD",
      sportLevel: "BEGINNER",
      email: "test@9.com",
      password: "password9",
    }),
    new User({
      name: "Julia",
      age: 29,
      height: 170,
      weight: 60,
      sexe: false,
      logo: "julia.png",
      nbSessionPerWeek: 3,
      goal: "Rester active",
      healthProblems: [],
      sport: "ELSE",
      sleepLevel: "GOOD",
      sportLevel: "SPORTY",
      email: "test@10.com",
      password: "password10",
    }),
  ];

  async login(email: string, password: string): Promise<User> {
    const user = this.users.find(
      (x) => x.email === email && x.password === password
    );

    if (!user) {
      throw new Error("User not found.");
    }

    return user;
  }
}
