{"size": 952, "ext": "js", "max_stars_repo_path": "src/stringify/sub.js", "max_stars_repo_name": "AndreyLysenkov/twitchy", "max_stars_repo_stars_event_min_datetime": "2020-01-24T16:05:15.000Z", "max_stars_repo_stars_event_max_datetime": "2020-01-24T16:05:15.000Z", "max_issues_repo_path": "src/stringify/sub.js", "max_issues_repo_name": "allan-walpy/twitchy", "max_issues_repo_issues_event_min_datetime": "2018-06-05T15:39:10.000Z", "max_issues_repo_issues_event_max_datetime": "2018-06-20T18:16:19.000Z", "max_forks_repo_path": "src/stringify/sub.js", "max_forks_repo_name": "AndreyLysenkov/twitchy", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 18, "max_forks_count": null, "avg_line_length": 21.6363636364, "max_line_length": 56, "alphanum_fraction": 0.5693277311}
const MainEvent = require('./main.js');

class SubEvent extends MainEvent {

    constructor() {
        super();
    }

    parse_normal_tier(config, entry) {
        return config.tier[entry.method.tier];
    }

    parse_normal(config, entry) {
        this.entry.parsed = {
            template: config.template,
            tier: this.parse_normal_tier(config, entry)
        };
    }

    parse_prime(config) {
        this.entry.parsed = {
            template: config.prime.template
        };
    }

    parse(config, entry) {
        this.__proto__.parse(config, entry);

        entry.addition = (entry.method.prime) ?
            this.parse_prime(config, entry)
            : this.parse_normal(config, entry);

        if (!entry.months)
            entry.months = 0;

        if (!entry.content)
            entry.content = config.content.none;

        return this.entry.parsed.template.format(entry);
    }

}

module.exports = SubEvent;