<?php namespace jasonwilliams\feed;

use System\Classes\PluginBase;
use JasonWilliams\Feed\Classes\SocialApis;

class Plugin extends PluginBase
{
  public function registerSettings()
  {
    return [
      'settings' => [
        'label'         => 'Feed',
        'description'   => 'Manage API keys and settings related to the feed plugin',
        'icon'          => 'icon-newspaper-o',
        'class'         => 'JasonWilliams\Feed\Models\Settings',
        'order'         => 500,
      ]
    ];
  }

  public function registerComponents()
  {
    return [
      '\JasonWilliams\Feed\Components\ShortFeed' => 'ShortFeed',
      '\JasonWilliams\Feed\Components\LazyLoadShortFeed' => 'LazyLoadShortFeed',
      '\JasonWilliams\Feed\Components\ChannelList' => 'ChannelList',
      '\JasonWilliams\Feed\Components\TagList' => 'TagList'
    ];
  }

  public function registerSchedule($schedule)
  {
    $schedule->call(function() {
      SocialApis::updateTwitter();
      SocialApis::updateInstagram();
      SocialApis::updateFoursquare();
    })->everyThirtyMinutes();
  }
}