<commit_before>// Code generated by nimona.io/tools/codegen. DO NOT EDIT.

package peer

import (
	json "encoding/json"

	crypto "nimona.io/pkg/crypto"
	object "nimona.io/pkg/object"
)

// basic structs
type (
	Peer struct {
		Addresses []string          `json:"addresses:as"`
		Signature *crypto.Signature `json:"@signature:o"`
	}
)

func (e *Peer) ContextName() string {
	return "nimona.io/peer"
}

func (e *Peer) GetType() string {
	return "nimona.io/peer/Peer"
}

func (e *Peer) ToObject() object.Object {
	m := map[string]interface{}{
		"@ctx:s":    "nimona.io/peer/Peer",
		"@struct:s": "Peer",
	}
	b, _ := json.Marshal(e)
	json.Unmarshal(b, &m)
	return object.Object(m)
}

func (e *Peer) FromObject(o object.Object) error {
	b, _ := json.Marshal(map[string]interface{}(o))
	return json.Unmarshal(b, e)
}

// domain events
type (
	PeerRequested struct {
		Keys      []string          `json:"keys:as"`
		Signature *crypto.Signature `json:"@signature:o"`
	}
	PeerUpdated struct {
		Addresses []string          `json:"addresses:as"`
		Signature *crypto.Signature `json:"@signature:o"`
	}
)

func (e *PeerRequested) ContextName() string {
	return "nimona.io/peer/Peer"
}

func (e *PeerRequested) EventName() string {
	return "Requested"
}

func (e *PeerRequested) GetType() string {
	return "nimona.io/peer/Peer.Requested"
}

func (e *PeerRequested) ToObject() object.Object {
	m := map[string]interface{}{
		"@ctx:s":    "nimona.io/peer/Peer.Requested",
		"@domain:s": "nimona.io/peer/Peer",
		"@event:s":  "Requested",
	}
	b, _ := json.Marshal(e)
	json.Unmarshal(b, &m)
	return object.Object(m)
}

func (e *PeerRequested) FromObject(o object.Object) error {
	b, _ := json.Marshal(map[string]interface{}(o))
	return json.Unmarshal(b, e)
}

func (e *PeerUpdated) ContextName() string {
	return "nimona.io/peer/Peer"
}

func (e *PeerUpdated) EventName() string {
	return "Updated"
}

func (e *PeerUpdated) GetType() string {
	return "nimona.io/peer/Peer.Updated"
}

func (e *PeerUpdated) ToObject() object.Object {
	m := map[string]interface{}{
		"@ctx:s":    "nimona.io/peer/Peer.Updated",
		"@domain:s": "nimona.io/peer/Peer",
		"@event:s":  "Updated",
	}
	b, _ := json.Marshal(e)
	json.Unmarshal(b, &m)
	return object.Object(m)
}

func (e *PeerUpdated) FromObject(o object.Object) error {
	b, _ := json.Marshal(map[string]interface{}(o))
	return json.Unmarshal(b, e)
}<commit_msg>refactor(peer): update generated peer<commit_after>// Code generated by nimona.io/tools/codegen. DO NOT EDIT.

package peer

import (
	json "encoding/json"

	crypto "nimona.io/pkg/crypto"
	object "nimona.io/pkg/object"
)

type (
	Peer struct {
		Addresses []string          `json:"addresses:as"`
		Signature *crypto.Signature `json:"@signature:o"`
	}
)

func (e *Peer) ContextName() string {
	return "nimona.io/peer"
}

func (e *Peer) GetType() string {
	return "Peer"
}

func (e *Peer) ToObject() object.Object {
	m := map[string]interface{}{
		"@ctx:s":    "Peer",
		"@struct:s": "Peer",
	}
	b, _ := json.Marshal(e)
	json.Unmarshal(b, &m)
	return object.Object(m)
}

func (e *Peer) FromObject(o object.Object) error {
	b, _ := json.Marshal(map[string]interface{}(o))
	return json.Unmarshal(b, e)
}

type (
	Requested struct {
		Keys      []string            `json:"keys:as"`
		Signature *crypto.Signature   `json:"@signature:o"`
		Authors   []*crypto.PublicKey `json:"@authors:ao"`
	}
	Updated struct {
		Addresses []string            `json:"addresses:as"`
		Signature *crypto.Signature   `json:"@signature:o"`
		Authors   []*crypto.PublicKey `json:"@authors:ao"`
	}
)

func (e *Requested) EventName() string {
	return "Requested"
}

func (e *Requested) GetType() string {
	return "Peer.Requested"
}

func (e *Requested) ToObject() object.Object {
	m := map[string]interface{}{
		"@ctx:s":    "Peer.Requested",
		"@domain:s": "Peer",
		"@event:s":  "Requested",
	}
	b, _ := json.Marshal(e)
	json.Unmarshal(b, &m)
	return object.Object(m)
}

func (e *Requested) FromObject(o object.Object) error {
	b, _ := json.Marshal(map[string]interface{}(o))
	return json.Unmarshal(b, e)
}

func (e *Updated) EventName() string {
	return "Updated"
}

func (e *Updated) GetType() string {
	return "Peer.Updated"
}

func (e *Updated) ToObject() object.Object {
	m := map[string]interface{}{
		"@ctx:s":    "Peer.Updated",
		"@domain:s": "Peer",
		"@event:s":  "Updated",
	}
	b, _ := json.Marshal(e)
	json.Unmarshal(b, &m)
	return object.Object(m)
}

func (e *Updated) FromObject(o object.Object) error {
	b, _ := json.Marshal(map[string]interface{}(o))
	return json.Unmarshal(b, e)
}
{'fraction_non_alphanumeric': 0.18028107158541942, 'fraction_numerical': 0.0, 'mean_word_length': 4.187927107061504, 'pattern_counts': {'":': 16, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3596234', 'n_tokens_mistral': 1772, 'n_tokens_neox': 1738, 'n_words': 373}