var greenIcon = new L.Icon({
    iconUrl: '/static/assets/leaflet/images/marker-icon-2x-green.png',
    shadowUrl: '/static/assets/leaflet/images/marker-shadow.png',
    iconSize: [25, 41],
    iconAnchor: [12, 41],
    popupAnchor: [1, -34],
    shadowSize: [41, 41]
});
var goldIcon = new L.Icon({
    iconUrl: '/static/assets/leaflet/images/marker-icon-2x-gold.png',
    shadowUrl: '/static/assets/leaflet/images/marker-shadow.png',
    iconSize: [25, 41],
    iconAnchor: [12, 41],
    popupAnchor: [1, -34],
    shadowSize: [41, 41]
});
function addObjectiveMarker(map, objective){
    var objectiveMarker = L.marker([
        objective['latitude'],
        objective['longitude']
    ])
    if(objective['found']){
        console.log('test')
        objectiveMarker.setIcon(goldIcon)
    }
    objectiveMarker.addTo(map);
    
    if(objective['hash']){
        objectiveMarker.bindTooltip(`${objective['name']}
        ${objective['hash']}`).openPopup();
    } else {
        objectiveMarker.bindTooltip(`${objective['name']}`).openPopup();
    }
}
function addPlayerMarker(map, player){
    var playerMarker = L.marker([
        player['latitude'],
        player['longitude']
    ], {icon: greenIcon}).addTo(map);
    var timestamp_utc = moment.utc(player['timestamp_utc']).toDate()
    var timestamp_local = moment(timestamp_utc).local().format('YYYY-MM-DD HH:mm');
    playerMarker.bindTooltip(`${player['username']}
                                ${timestamp_local}`).openPopup();
}