// 1. Union Types & Intersection Types
type User = { name: string; email: string };
type Admin = { name: string; adminLevel: number };
type Person = { name: string; age: number };
type Worker = { employeeId: number };

type UserOrAdmin = // TODO
type Employee = // TODO

// 2. Discriminated Unions
type Circle = // TODO
type Rectangle = // TODO
type Shape = // TODO

function calculateArea(shape) {
    // TODO: Fläche berechnen
}

// 3. Tuple Types
type Coordinate = // TODO

function getDistance(a, b) {
    // TODO: Distanz zwischen zwei Punkten berechnen
}

// 4. Mapped Types & Utility Types
type ReadonlyPerson = // TODO

function updatePerson(person: ReadonlyPerson) {
    // TODO: Versuchen, eine Eigenschaft zu ändern
}

// 5. Conditional Types
type IsString<T> = // TODO

type Test1 = IsString<>;  // Erwartet: "Ja"
type Test2 = IsString<>;  // Erwartet: "Nein"
type Test3 = IsString<>;  // Erwartet: "Nein"

// 6. Type Guards
function isString(value: unknown) {
    // TODO: Implementieren
}

function printUpperCase(value: unknown) {
    // TODO: Type Guard nutzen
}


// Bonus Challenge
type Vehicle = { type: "car"; speed: number } | { type: "bike"; gear: number };

function isCar(vehicle) {
    // TODO
}

function describeVehicle(vehicle: Vehicle) {
    if (isCar(vehicle)) {
        // TODO LOG: Auto mit Geschwindigkeit: XY km/h
    } else {
      // TODO LOG: Fahrrad mit Gangzahl: XY
    }
}

describeVehicle(myCar); 
describeVehicle(myBike);