import numpy as np
import nsr


if __name__ == "__main__":
    grade_cu = 0.12314
    grade_au = 0.1662
    recovery_cu = 74.18866
    recovery_au = 81.45106
    concentrate_cu = 19.962952
    concentrate_au = 60.92745
    concentrate_f = 1450.2705
    
    dollar2ausd = 0.8
    
    price_cu = 2.29 / dollar2ausd
    pon_to_ton = 453.59237
    price_au = 1294.55 / dollar2ausd
    
    deduct_cu =1.0 #%
    deduct_proportion_cu = 0.965
    deduct_au = 1.3 #g/t conc
    deduct_proportion_au = 0.975
    
    treatment_cost_cu = 100.0
    
    refining_cost_cu = 0.1 #US$/lb
    refining_cost_au = 8.75 #US$/oz
    
    refining_charges = 0.00 #US$/lb
    
    penalties = 0
    verbose = False
    marketing_charge = 0.0 #%
    treatment_distribution_charge = 0.0

    transportation_costs = 100.388
    moisture = 0.085
    marine_insurence = 0.0175 / 100.0
    milling_costs = 8.0 # $/t
    transportation_losses = 0.008
    #royalty
    royalty = 0.04
    admi_costs_royalty = 1.6
    allowable_depreciation_royalty = 1.09

    min_concentrate_cu = 22.0
    penalty_min_concentrate_cu = 7.5

    mining_costs = 5.1
    site_costs = 13.4

    ret = nsr.calculateNSRNewcrest(
        #cu
        grade_cu,
        recovery_cu,
        concentrate_cu,
        price_cu,
        #au
        grade_au,
        recovery_au,
        concentrate_au,
        price_au,
        #cost cu
        deduct_cu,
        deduct_proportion_cu,
        refining_cost_cu,
        treatment_cost_cu,
        #cost au
        deduct_au,
        deduct_proportion_au,
        refining_cost_au,
        #penalties realted low copper
        min_concentrate_cu,
        penalty_min_concentrate_cu,
        #penalties related F
        concentrate_f,
        [300,700],
        [100,100],
        [1.25,1.875],
        #others
        transportation_costs, # $/t
        moisture,
        marine_insurence,
        milling_costs, # $/t
        transportation_losses, # %
        #royalty
        royalty, #%
        admi_costs_royalty, # $/t
        allowable_depreciation_royalty, # $/t        
        mining_costs,
        site_costs,
        True)

    print ret
