class Components::Admin::StateReportingSyncChannel < ApplicationCable::Channel
  def subscribed
    stream_from "components_admin_state_reporting_sync_channel_#{current_user.school_id}"
    ActionCable.server.broadcast(
      "components_admin_state_reporting_sync_channel_#{current_user.school_id}",
      props(current_user.school_id)
    )
  end

  private
    def props(school_id)
      config = School.find(school_id).current_year.state_reporting_config
      config.job_statuses
    end
end
