using System.Collections;
using System.Collections.Generic;
using UnityEngine;


[System.Serializable]
public class JobInstance
{
    public int templateIndex;

    public string title;
    public string description;
    public bool showJobTitlePrefix;

    public string zoneName;
    public string levelName;
    public bool isHostileZone;

    public int coinReward;
    public float experienceReward;
    public float reputationReward;

    public bool completed;

    public void SetupJobDescription(string title, string description, bool showJobTitlePrefix)
    {
        this.title = title;
        this.description = description;
        this.showJobTitlePrefix = showJobTitlePrefix;
    }

    public void SetupZone(string zoneName, string levelName, bool isHostileZone)
    {
        this.zoneName = zoneName;
        this.levelName = levelName;
        this.isHostileZone = isHostileZone;
    }

    public void SetupRewards(int coin, float experience, float reputation)
    {
        coinReward = coin;
        experienceReward = experience;
        reputationReward = reputation;
    }

    public void UpdateRewardsBasedOnTemplateAndDifficulty(JobTemplate usedTemplate)
    {
        coinReward = Mathf.RoundToInt(usedTemplate.baseCoinReward + usedTemplate.baseCoinReward * usedTemplate.percentCoinReward * (GameDifficultyController.Instance.GetCurrentDifficultyLevel() - 1));
        experienceReward = usedTemplate.baseExperienceFinalReward + usedTemplate.baseExperienceFinalReward * usedTemplate.percentExperienceFinalReward * (GameDifficultyController.Instance.GetCurrentDifficultyLevel() - 1);
        reputationReward = usedTemplate.baseReputationFinalReward + usedTemplate.baseReputationFinalReward * usedTemplate.percentReputationFinalReward * (GameDifficultyController.Instance.GetCurrentDifficultyLevel() - 1);
    }

    public JobInstance()
    {

    }

    public JobInstance(JobTemplate jobTemplate)
    {
        this.title = jobTemplate.title;
        this.description = jobTemplate.description;
        this.showJobTitlePrefix = jobTemplate.showJobTitlePrefix;

        this.zoneName = jobTemplate.zoneName;
        this.levelName = jobTemplate.levelName;
        this.isHostileZone = jobTemplate.isHostileZone;

        completed = false;
    }
}