module Youtube class TeamStatus PLATFORM_LABEL = "Match Live TV".freeze def initialize(team) @team = team @ent = team.entitlements @mode = @ent.plan.youtube_mode end def selectable? return false unless @ent.youtube_enabled? case @mode when "matchlivetv_light" PlatformCredential.configured? when "team" @team.youtube_credential.present? else false end end def connected? selectable? end def uses_platform_channel? @mode == "matchlivetv_light" && PlatformCredential.configured? end def channel_title if uses_platform_channel? PLATFORM_LABEL else @team.youtube_credential&.channel_title end end def needs_team_oauth? @mode == "team" && @ent.premium_full? end end end