"""
Stochastic Model Gender Diversity 5 Year Forecasts
---------------------

This is the second generation of the gender diversity model
with 5 year forecasts.




Notes:
09/14/2017 - This is the first version of the second generate model.
"""
__author__ = 'krishnab'
__version__ = '0.1.0'
import numpy as np
import pandas as pd
from numpy.random import binomial, multinomial
from .Models import Base_model
from .ModelGenderDiversity import Model3GenderDiversity
import itertools
import math
from .ColumnSpecs import MODEL_RUN_COLUMNS, EXPORT_COLUMNS_FOR_CSV




class ModelGenderDiversityGrowthForecast(Model3GenderDiversity):
    def __init__(self, argsdict):
        Base_model.__init__(self,  argsdict)
        self.name = "model-3-5-year-growth-forecast"
        self.label = "model-3-5-year-growth-forecast"

    def init_growth_rate(self, candidate):
        self.growth_forecasts = candidate

    def calculate_yearly_dept_size_targets(self):

        repeat_interval = self.__calculate_forecast_interval()
        return list(itertools.chain.from_iterable(itertools.repeat(x, repeat_interval) for x in self.growth_forecasts))

    def __calculate_forecast_interval(self):

        return math.ceil(self.duration/len(self.growth_forecasts))