package movierental;

import movierental.MoviePriceCalculation.MoviePriceCalculationStrategy;

public class Movie {

    public static final int CHILDRENS = 2;
    public static final int NEW_RELEASE = 1;
    public static final int REGULAR = 0;

    private String _title;
    private int _priceCode;
    private MoviePriceCalculationStrategy moviePriceCalculationStrategy;

    public Movie(String title, int priceCode) {
        _title = title;
        _priceCode = priceCode;
        switch (priceCode) {
            case REGULAR:
                moviePriceCalculationStrategy = new movierental.MoviePriceCalculation.RegularMoviePriceCalculation();
                break;
            case NEW_RELEASE:
                moviePriceCalculationStrategy = new movierental.MoviePriceCalculation.NewReleaseMoviePriceCalculation();
                break;
            case CHILDRENS:
                moviePriceCalculationStrategy = new movierental.MoviePriceCalculation.ChildrenMoviePriceCalculation();
                break;
        }
    }

    public int getPriceCode() {
        return _priceCode;
    }

    public void setPriceCode(int arg) {
        _priceCode = arg;
    }

    public String getTitle() {
        return _title;
    }

    public double calculatePrice(int daysRented) {
        return moviePriceCalculationStrategy.calculatePrice(daysRented);
    }

}
