type User = { name: string; age: number; isActive: boolean };

export function createUserProfile(
  name: string,
  age: number,
  isActive: boolean = true
): User {
  const user = { name, age, isActive };
  return user;
}

export function getUserStatus(age: number): string {
  if (age < 18) return 'Minderjährig';
  if (age > 65) return 'Erwachsen';
  return 'Senior';
}

export function calculateBirthYear(age: number): number {
  const currentYear = new Date().getFullYear();
  return currentYear - age;
}

export function logUserInfo(name: string, age: number | string): string {
  return `Der Nutzer ${name} ist ${age} Jahre alt`;
}

console.log(createUserProfile('Alice', 30));

console.log(getUserStatus(17));
console.log(getUserStatus(40));
console.log(getUserStatus(81));

console.log(calculateBirthYear(30));

console.log(logUserInfo('Alice', 30));
console.log(logUserInfo('Bob', 'dreißig'));
