### Persefone - a socio-economic-ecological model of European agricultural landscapes.
###
### This file holds the code for the Eurasian Skylark (Alauda arvensis).
###

"""
    Skylark

*Alauda arvensis* is a common and charismatic species of agricultural landscapes.
At the moment, this implementation is still in development.
"""
@species Skylark begin

    popsize = Int(round(1/10000*reduce(*, size(model.landscape))))
    lifeexpectancy = 365*5

    eggharvestmortality = 0.9
    eggpredationmortality = 0.1
    
    initialise! = initrandompopulation(popsize)

    habitats = @habitat((@landcover() == grass || 
                         (@landcover() == agriculture && @croptype() != maize &&
                          @cropheight() < 10)) &&
                        @distanceto(forest) > 20)
    
    @phase egg begin
        @kill(@trait(eggpredationmortality), "predation")

        #TODO dies if parents die
        
        @respond harvest @kill(@trait(eggharvestmortality), "harvest")

        if @trait(age) == 14
            @setphase(nestling)
        end
    end

    @phase nestling begin
        #TODO
    end

    #TODO
end