classDiagram
    class ShippingCompany {
        +**Long id**
        +**String name**
    }
    note for ShippingCompany "Company owning and operating vessels"

    class Vessel {
        +**Long id**
        +**Long companyId**
        +**String name**
        +**String type**
    }
    note for Vessel "A ship that can perform multiple trips"

    class Trip {
        +**Long id**
        +**Long vesselId**
        +**String pilotageReference**
        +**String captainName**
        +**Long startLocationId**
        +**Long endLocationId**
    }
    note for Trip "Planned journey with unique pilotage reference"

    class Itinerary {
        +**Long id**
        +**Long tripId**
        +**Date plannedDate**
    }
    note for Itinerary "Planned route with scheduled dates"

    class Location {
        +**Long id**
        +**String name**
        +**String type**
    }
    note for Location "Can be either a port or pilotage area"
    note for Location "Note: Consider if locations for worklog (entry/exit points)\n need to be distinguished from regular ports/areas used\n in itineraries and user trips"

    class Point {
        +**Long id**
        +**String name**
        +**Float latitude**
        +**Float longitude**
    }
    note for Point "Geographic point that can serve as entry or exit for multiple locations"

    class LocationPoint {
        +**Long id**
        +**Long locationId**
        +**Long pointId**
    }
    note for LocationPoint "Assigns geographic points to locations.\nWhether it's an entry or exit point is determined by the context of the route"

    class User {
        +**Long id**
        +**String firstName**
        +**String lastName**
        +**String email**
        +**String pilotageId**
    }
    note for User "Pilot with unique pilotage identification number"

    class UserTrip {
        +**Long id**
        +**Long tripId**
        +**Long userId**
        +**String captainName**
        +**Date actualDate**
    }
    note for UserTrip "Actual execution of a planned trip"

    class WorkLog {
        +**Long id**
        +**Long userTripId**
        +**Long startLocationId**
        +**Long endLocationId**
        +**Date logDate**
        +**Duration draught**
    }
    note for WorkLog "Records of work duration between locations"
    
    ShippingCompany "1" -- "*" Vessel
    Vessel "1" -- "*" Trip
    Trip "1" -- "1" Itinerary
    Trip "1" -- "*" UserTrip
    Itinerary "1" -- "*" Location
    UserTrip "1" -- "*" Location
    UserTrip "1" -- "*" WorkLog
    WorkLog "*" -- "2" Location : start/end points
    User "1" -- "*" UserTrip
    Location "1" -- "*" LocationPoint
    LocationPoint "*" -- "1" Point
    
    note "Relationships explained:\n1. Each shipping company has multiple vessels (companyId)\n2. Vessels can make multiple trips (vesselId)\n3. Each trip has one planned itinerary (tripId)\n4. Trips can have multiple actual executions as UserTrips (tripId)\n5. Each itinerary defines a sequence of planned locations\n6. Each user trip records a sequence of actual visited locations\n7. Work logs track time spent between locations (startLocationId/endLocationId)\n8. Each user can perform multiple user trips (userId)\n9. Each location can have multiple points (locationId)\n10. Each point can be used by multiple locations (pointId)"
