package h05;

public class PassengerPlane extends Plane implements CarriesPassengers {

    protected static final char AVERAGE_PEOPLE_WEIGHT = 100;
    protected static final char AVERAGE_LUGGAGE_WEIGHT = 15;

    private final int crewCount;

    private int passengerCount = 0;

    public PassengerPlane(String aircraftRegistration, int baseWeight, FuelType fuelType, double fuelCapacity, int crewCount) {
        super(aircraftRegistration, baseWeight, fuelType, fuelCapacity);
        this.crewCount = crewCount;
    }

    @Override
    protected double mass() {
        return getBaseWeight() + passengerCount * AVERAGE_LUGGAGE_WEIGHT + passengerCount * AVERAGE_PEOPLE_WEIGHT + crewCount * AVERAGE_PEOPLE_WEIGHT;
    }

    @Override
    public void board(int passengers) {
        passengerCount += passengers;
    }

    @Override
    public void disembark() {
        passengerCount = 0;
    }

    @Override
    public int getPassengerCount() {
        return passengerCount;
    }
}
