package model

import (
	"crypto/sha256"
	"fmt"
)

func (b BeaconEvent) Hash() []byte {
	rBatt := (b.Battery / 10) * 10
	c := fmt.Sprintf("%d%d%s%s%s", rBatt, b.Event, b.ID, b.Name, b.Type)
	h := sha256.New()
	h.Write([]byte(c))

	bs := h.Sum(nil)
	return bs
}
