<!--
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (c) 2014 Mozilla Corporation

Contributors:
Jeff Bryner jbryner@mozilla.com
-->

<template name="attackerdetails">
<div class="container">
    <div class="row center">
        <div id="attacker" >
            <table class="table table-reactive table-hover table-condensed" id="alert-table">
                <thead>
                    <tr>
                        <td class="upperwhite">Last Seen</td>
                        <td class="upperwhite">Created</td>
                        <td class="upperwhite">Events</td>
                        <td class="upperwhite">Alerts</td>
                        <td class="upperwhite">Category</td>
                        <td class="upperwhite">Summary</td>
                    </tr>
                </thead>
                <tbody>
			<tr>
				<td>{{lastseentimestamp}}</td>
                <td>{{dateCreated}}</td>
                <td>{{eventscount}}</td>
				<td>{{alertscount}}</td>
                <td>
                    <select id="attackerCategory" name="category" class="form-control" title="category of this attacker">
                        <option {{ isselected 'unknown' category }} value='unknown'>Unknown</option>
                        <option {{ isselected 'skiddie' category }} value='skiddie'>Script Kiddie</option>
                        <option {{ isselected 'bruteforcer' category }} value='bruteforcer'>Brute Forcer</option>
                        <option {{ isselected 'bountyhunter' category }} value='bountyhunter'>Bounty Hunter</option>
                        <option {{ isselected 'apt' category }} value='apt'>APT</option>
                        <option {{ isselected 'falsepositive' category }} value='falsepositive'>False Positive</option>
                    </select>
                </td>
                <td>{{summary}}</td>
			</tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class="row center">
        <caption><h5>Alerts</h5></caption>
        <table class="table table-reactive table-hover table-condensed " id="attacker-alerts-table">
            <tbody class="table-striped">
                {{#each this.alerts}}
                    {{#with thisalert this.alertid}}
                        {{>attacker_alert}}
                    {{/with}}
                {{/each}}
            </tbody>
        </table>
    </div>
    <div class="row center">
    <caption><h5>Events</h5></caption>
    <table class="table table-reactive table-hover table-condensed" id="attacker-events-table">
        <tbody class="table-striped">
            {{#each this.events}}
                {{>attacker_event}}
            {{/each}}
        </tbody>
    </table>
    </div>
    
   
</div>

</template>


<!--each individual alert -->
<template name="attacker_alert">
    
        <tr>
            <td><a href="{{getAlertURL _id}}" target="_blank">MozDef</a></td>
            <td>{{utctimestamp}}</td>
            <td>{{severity}}</td>
            <td>{{category}}</td>
            <td>{{summary}}</td>
        </tr>

</template>

<!--each individual event -->
<template name="attacker_event">

        <tr>
            <td>{{documentindex}}</td>
            <td>{{documentid}}</td>
            <td>{{documenttype}}</td>
            <td>{{documentsource.summary}}</td>
            <td>{{>eventdetails}}</td>
        </tr>

</template>


