import { SyncedCron } from 'meteor/percolate:synced-cron';

import NFLService from './nfl-service.js';
import ProlineService from './proline-service.js';

export default class CronService {

  constructor() {

  }

  static start() {

    SyncedCron.start();

  }

  static stop() {

    SyncedCron.stop();

  }

  static register() {

    SyncedCron.add({
      name: 'Get inital week from NFL website',
      schedule: function(parser) {
        // parser is a later.parse object
        return parser.text('at 9:55 pm');
        // return parser.text('every 30 seconds');
      },
      job: function() {
        // Live Data
        NFLService.getScores();

        // Mock Data
        // NFLService.getStaticScores();
      }
    });

    SyncedCron.add({
      name: 'Get scores from NFL website',
      schedule: function(parser) {
        // parser is a later.parse object
        return parser.text('every 2 minutes every Thurs,Sun and Mon');
        // return parser.text('every 30 seconds');
      },
      job: function() {
        // Live Data
        NFLService.getScores();

        // Mock Data
        // NFLService.getStaticScores();
      }
    });

    SyncedCron.add({
      name: 'Get point spread from Proline website',
      schedule: function(parser) {
        // parser is a later.parse object
        return parser.text('at 11:30 pm');
        // return parser.text('every 30 seconds');
      },
      job: function() {
        // Live Data
        ProlineService.getPointSpread();

        // Mock Data
        // ProlineService.getStaticPointSpread();
      }
    });

  }


}

import { SyncedCron } from 'meteor/percolate:synced-cron';

import NFLService from './nfl-service.js';
import ProlineService from './proline-service.js';

export default class CronService {

  constructor() {

  }

  static start() {

    SyncedCron.start();

  }

  static stop() {

    SyncedCron.stop();

  }

  static register() {

    SyncedCron.add({
      name: 'Get inital week from NFL website',
      schedule: function(parser) {
        // parser is a later.parse object
        return parser.text('at 9:55 pm');
        // return parser.text('every 30 seconds');
      },
      job: function() {
        // Live Data
        NFLService.getScores();

        // Mock Data
        // NFLService.getStaticScores();
      }
    });

    SyncedCron.add({
      name: 'Get scores from NFL website',
      schedule: function(parser) {
        // parser is a later.parse object
        return parser.text('every 2 minutes every Thurs,Sun and Mon');
        // return parser.text('every 30 seconds');
      },
      job: function() {
        // Live Data
        NFLService.getScores();

        // Mock Data
        // NFLService.getStaticScores();
      }
    });

    SyncedCron.add({
      name: 'Get point spread from Proline website',
      schedule: function(parser) {
        // parser is a later.parse object
        return parser.text('at 10:00 am');
        // return parser.text('every 30 seconds');
      },
      job: function() {
        // Live Data
        ProlineService.getPointSpread();

        // Mock Data
        // ProlineService.getStaticPointSpread();
      }
    });

  }


}

modify proline schedule