package flashscore

// Оставил только счет по таймам. Вырезал ленту событий (голы, пенальти, карточки)
// Анализ:
// - находим .detailMS__headerText с контентом "1st Half" или "2nd Half"
// - переходим к след. Div (nextSibling), проверяем что это .detailMS__headerScore
// - внутри ищем span.p1_home и span.p1_away
var footballMatchSummary = `
<div class="detailMS">
    <div class="detailMS__incidentsHeader stage-12">
        <div class="detailMS__headerText">1st Half</div>
        <div class="detailMS__headerScore">
            <span class="p1_home" title="">1</span> - <span class="p1_away" title="">0</span>
        </div>
    </div>

<div class="detailMS__incidentRow incidentRow--home odd">
</div>

<div class="detailMS__incidentsHeader stage-13">
    <div class="detailMS__headerText">2nd Half</div>
    <div class="detailMS__headerScore">
        <span class="p2_home" title="">3</span> -<span class="p2_away" title="">0</span>
    </div>
</div>`

// Пример пустой статистики
var emptyMatchSummary = `
<div class="detailMS">
	<div class="detailMS__incidentsHeader stage-9999">
		<div class="detailMS__headerText"></div>
		<div class="detailMS__headerScore">
			<span class="p1_home" title="">0</span> -<span class="p1_away"	title="">2</span>
		</div>
	</div>
	<div class="detailMS__incidentRow --empty odd">
		- 
	</div>
</div>

<div class="match-information-wrapper">
<div class="parts match-information">
	<div>
		<div class="stage-header">
			<div class="h-part">Match Information</div>
		</div>
		<div class="match-information-data">
			<div class="content">Venue: Carrow Road (Norwich)</div>
		</div>
	</div>
</div>`

// На странице h2h landing
var matchZoneChampAndRound = `
<span class="description__country">
	ENGLAND: 
	<a href="#" onclick="window.open('/football/england/premier-league/'); return false;">
		Premier League - Round 30
	</a>
</span>`

// На странице h2h landing
// Самый простой способ - найти два Div с классом tomyteams. Первый - хозяева, второй - гости. TeamID достать из id атрибута
var teamID = `
<div class="team-text tname-home">
	<div class="tname">
		<div class="tname__text">
			<span style="display: none" class="dw-icon ico">&nbsp;</span>
			<a href="#" class="participant-imglink" onclick="window.open('/team/newcastle-utd/p6ahwuwJ'); return false;">Newcastle</a>
		</div>
	</div>
</div>

<div class="team-text tname-away">
	<div class="tname">
		<div class="tname__text">
			<a href="#" class="participant-imglink" onclick="window.open('/team/norwich/Qo6off6p'); return false;">Norwich</a>
			<span style="display: none" class="dw-icon ico">&nbsp;</span>
		</div>
	</div>
</div>
`

var footballMatchScore = `
<div class="match-info">
	<div class="current-result" id="event_detail_current_result">
		<span class="scoreboard">1</span>
		<span>
			<span class="scoreboard-divider">-</span>
			<span class="scoreboard">0</span>
		</span>
	</div>
	<div class="info-status mstat">
		Finished
	</div>
</div>`

var footballMatchNotStarted = `
<div class="match-info">
	<div class="current-result" id="event_detail_current_result">
		<span class="scoreboard-divider">-</span>
	</div>
	<div class="info-status mstat">
		&nbsp;
	</div>
</div>`

// Время матча отдельным запросом на адрес Request URL: https://d.flashscore.com/x/feed/dc_1_riQ962dS
// где riQ962dS - matchID
// Время матча в поле DD или DC
var encodedMatchTime = `DA÷1¬DZ÷1¬DB÷1¬DD÷1592586000¬AW÷1¬DC÷1592586000¬DS÷0¬DI÷-1¬DL÷1¬DM÷No spectators.¬DT÷¬DX÷MC,OD,HH,SCR,LT,TA,TV,NF¬DEI÷https://www.flashscore.com/res/image/data/CY8Xm4wS-Am48qVMh-Ozt88U7U.png¬DV÷1¬SC÷16¬SB÷1¬SD÷bet365¬A1÷¬~`

// Где счет и надпись Finished
var liveFootballMatchInfo = `<div class="match-info">
<div class="current-result" id="event_detail_current_result">
	<span class="scoreboard-divider">-</span>
</div>
<div class="info-status mstat">
	2nd Half
</div>

</div>`

// На странице команды
// Находим ссылки внутри h2.tournament и проверяем href
var teamZone = `<h2 class="tournament">
	<div class="sportIcon sportIcon--soccer"></div>
	<a href="/football/">Football</a> 
	<span class="breadcrumb__arrow"></span>
	<span class="flag fl_198"></span>
	<a href="/football/england/">England</a>
</h2>`

// Full Time OVER/UNDER внутри блока block-under-over-ft
// Последние курсы на тотал 2.5 имеют класс .not-published, что означает - удалены букмекером.
// На сайте flashscore отображаются перечеркнутыми
var overUnderOdds = `<div id="block-under-over-ft" class="odds-table-wrapper" style="display: block;">
	<table id="odds_ou_0.5" class="odds sortable" cellspacing="0">
		<colgroup>
		<col/>
		<col width="60"/>
		<col width="60"/>
		<col width="60"/>
		</colgroup>
		<thead>
		<tr>
			<th class="bookmaker no-padding unsortable">Bookmaker</th>
			<th class="unsortable">Total</th>
			<th>Over</th>
			<th>Under</th>
		</tr>
		</thead>
		<tbody>
		<tr class="odd">
			<td class="bookmaker">
				<div class="blink" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_bookmaker');"><a href="/bookmaker/417/?sport=1&from=odds-comparison" onclick="return !window.open(this.href)" title="1xBet" class="elink"><span style="background-image:url(/res/image/data/bookmakers/30-417.png); background-size: 100%; background-repeat: no-repeat;" class="detail-blogos"></span></a></div>
				<div title="This match will be available for LIVE betting!" onmouseover="tt.show(this, event)" onmouseout="tt.hide(this)" class="live-icon-bookmaker" onclick="window.open('/bookmaker/417/?sport=1&from=live-detail' + (window.fs_detail && fs_detail.DA ? (fs_detail.DA == cjs.Api.constantsManager.getEventStageTypes().LIVE ? '-live-match' : '') : ''));"><span class="icon live-offer1" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_live-offer');">&nbsp;</span></div>
			</td>
			<td>0.5</td>
			<td class="kx" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_over');"><span class=" odds-wrap  up" alt="1.07[u]1.09:">1.09</span></td>
			<td class="kx" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_under');"><span class=" odds-wrap  down" alt="7.00[d]5.90:">5.90</span></td>
		</tr>
		<tr class="even">
			<td class="bookmaker">
				<div class="blink" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_bookmaker');"><a href="/bookmaker/16/?sport=1&from=odds-comparison" onclick="return !window.open(this.href)" title="bet365" class="elink"><span style="background-image:url(/res/image/data/bookmakers/30-16.png); background-size: 100%; background-repeat: no-repeat;" class="detail-blogos"></span></a></div>
				<div title="This match will be available for LIVE betting!" onmouseover="tt.show(this, event)" onmouseout="tt.hide(this)" class="live-icon-bookmaker" onclick="window.open('/bookmaker/16/?sport=1&from=live-detail' + (window.fs_detail && fs_detail.DA ? (fs_detail.DA == cjs.Api.constantsManager.getEventStageTypes().LIVE ? '-live-match' : '') : ''));"><span class="icon live-offer1" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_live-offer');">&nbsp;</span></div>
			</td>
			<td>0.5</td>
			<td class="kx max" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_over');"><span class=" odds-wrap  up" alt="1.10[u]1.11:">1.11</span></td>
			<td class="kx" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_under');"><span class=" odds-wrap  down" alt="7.00[d]6.50:">6.50</span></td>
		</tr>
		</tbody>
	</table>
	<table id="odds_ou_2.5" class="odds sortable" cellspacing="0">
	<colgroup>
	<col/>
	<col width="60"/>
	<col width="60"/>
	<col width="60"/>
	</colgroup>
	<thead>
	<tr>
		<th class="bookmaker no-padding unsortable">Bookmaker</th>
		<th class="unsortable">Total</th>
		<th>Over</th>
		<th>Under</th>
	</tr>
	</thead>
	<tbody>
	<tr class="odd">
		<td class="bookmaker">
			<div class="blink" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_bookmaker');"><a href="/bookmaker/417/?sport=1&from=odds-comparison" onclick="return !window.open(this.href)" title="1xBet" class="elink"><span style="background-image:url(/res/image/data/bookmakers/30-417.png); background-size: 100%; background-repeat: no-repeat;" class="detail-blogos"></span></a></div>
			<div title="This match will be available for LIVE betting!" onmouseover="tt.show(this, event)" onmouseout="tt.hide(this)" class="live-icon-bookmaker" onclick="window.open('/bookmaker/417/?sport=1&from=live-detail' + (window.fs_detail && fs_detail.DA ? (fs_detail.DA == cjs.Api.constantsManager.getEventStageTypes().LIVE ? '-live-match' : '') : ''));"><span class="icon live-offer1" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_live-offer');">&nbsp;</span></div>
		</td>
		<td>2.5</td>
		<td class="kx max" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_over');"><span class=" odds-wrap  up" alt="2.41[u]2.91:">2.91</span></td>
		<td class="kx" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_under');"><span class=" odds-wrap  down" alt="1.54[d]1.52:">1.52</span></td>
	</tr>
	<tr class="even">
		<td class="bookmaker">
			<div class="blink" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_bookmaker');"><a href="/bookmaker/16/?sport=1&from=odds-comparison" onclick="return !window.open(this.href)" title="bet365" class="elink"><span style="background-image:url(/res/image/data/bookmakers/30-16.png); background-size: 100%; background-repeat: no-repeat;" class="detail-blogos"></span></a></div>
			<div title="This match will be available for LIVE betting!" onmouseover="tt.show(this, event)" onmouseout="tt.hide(this)" class="live-icon-bookmaker" onclick="window.open('/bookmaker/16/?sport=1&from=live-detail' + (window.fs_detail && fs_detail.DA ? (fs_detail.DA == cjs.Api.constantsManager.getEventStageTypes().LIVE ? '-live-match' : '') : ''));"><span class="icon live-offer1" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_live-offer');">&nbsp;</span></div>
		</td>
		<td>2.5</td>
		<td class="kx" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_over');"><span class=" odds-wrap  up" alt="2.50[u]2.75:">2.75</span></td>
		<td class="kx" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_under');"><span class=" odds-wrap  down" alt="1.53[d]1.44:">1.44</span></td>
	</tr>
	<tr class="odd">
		<td class="bookmaker">
			<div class="blink" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_bookmaker');"><a href="/bookmaker/15/?sport=1&from=odds-comparison" onclick="return !window.open(this.href)" title="William Hill" class="elink"><span style="background-image:url(/res/image/data/bookmakers/30-15.png); background-size: 100%; background-repeat: no-repeat;" class="detail-blogos"></span></a></div>
		</td>
		<td>2.5</td>
		<td class="kx" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_over');"><span class="not-published odds-wrap " alt=":">2.38</span></td>
		<td class="kx" onclick="e_t.track_click('bookmaker-button-click', 'block-under-over_ft_under');"><span class="not-published odds-wrap " alt=":">1.53</span></td>
	</tr>
	</tbody>
	</table>
</div>`

// CHECK https://www.flashscore.com/match/vZNmafet/#match-summary EXTRA TIME
