func (this *W3IDSecurityV1PublicKeyProperty) PrependType(t vocab.Type) error {
	n := &W3IDSecurityV1PublicKeyPropertyIterator{
		alias:  this.alias,
		myIdx:  0,
		parent: this,
	}
	if err := n.SetType(t); err != nil {
		return err
	}
	this.properties = append([]*W3IDSecurityV1PublicKeyPropertyIterator{n}, this.properties...)
	for i := 1; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
	return nil
}
PrependType prepends an arbitrary type value to the front of a list of the
property "publicKey". Invalidates all iterators. Returns an error if the
type is not a valid one to set for this property.
package propertypublickey
import (
	"fmt"
	vocab "github.com/go-fed/activity/streams/vocab"
	"net/url"
)
type W3IDSecurityV1PublicKeyPropertyIterator struct {
	w3idsecurityv1PublicKeyMember vocab.W3IDSecurityV1PublicKey
	unknown                       interface{}
	iri                           *url.URL
	alias                         string
	myIdx                         int
	parent                        vocab.W3IDSecurityV1PublicKeyProperty
}
func NewW3IDSecurityV1PublicKeyPropertyIterator() *W3IDSecurityV1PublicKeyPropertyIterator {
	return &W3IDSecurityV1PublicKeyPropertyIterator{alias: ""}
}
func deserializeW3IDSecurityV1PublicKeyPropertyIterator(i interface{}, aliasMap map[string]string) (*W3IDSecurityV1PublicKeyPropertyIterator, error) {
	alias := ""
	if a, ok := aliasMap["https://w3id.org/security/v1"]; ok {
		alias = a
	}
	if s, ok := i.(string); ok {
		u, err := url.Parse(s)
		if err == nil && len(u.Scheme) > 0 {
			this := &W3IDSecurityV1PublicKeyPropertyIterator{
				alias: alias,
				iri:   u,
			}
			return this, nil
		}
	}
	if m, ok := i.(map[string]interface{}); ok {
		if v, err := mgr.DeserializePublicKeyW3IDSecurityV1()(m, aliasMap); err == nil {
			this := &W3IDSecurityV1PublicKeyPropertyIterator{
				alias:                         alias,
				w3idsecurityv1PublicKeyMember: v,
			}
			return this, nil
		}
	}
	this := &W3IDSecurityV1PublicKeyPropertyIterator{
		alias:   alias,
		unknown: i,
	}
	return this, nil
}
func (this W3IDSecurityV1PublicKeyPropertyIterator) Get() vocab.W3IDSecurityV1PublicKey {
	return this.w3idsecurityv1PublicKeyMember
}
func (this W3IDSecurityV1PublicKeyPropertyIterator) GetIRI() *url.URL {
	return this.iri
}
func (this W3IDSecurityV1PublicKeyPropertyIterator) GetType() vocab.Type {
	if this.IsW3IDSecurityV1PublicKey() {
		return this.Get()
	}
	return nil
}
func (this W3IDSecurityV1PublicKeyPropertyIterator) HasAny() bool {
	return this.IsW3IDSecurityV1PublicKey() || this.iri != nil
}
func (this W3IDSecurityV1PublicKeyPropertyIterator) IsIRI() bool {
	return this.iri != nil
}
func (this W3IDSecurityV1PublicKeyPropertyIterator) IsW3IDSecurityV1PublicKey() bool {
	return this.w3idsecurityv1PublicKeyMember != nil
}
func (this W3IDSecurityV1PublicKeyPropertyIterator) JSONLDContext() map[string]string {
	m := map[string]string{"https://w3id.org/security/v1": this.alias}
	var child map[string]string
	if this.IsW3IDSecurityV1PublicKey() {
		child = this.Get().JSONLDContext()
	}
	for k, v := range child {
		m[k] = v
	}
	return m
}
func (this W3IDSecurityV1PublicKeyPropertyIterator) KindIndex() int {
	if this.IsW3IDSecurityV1PublicKey() {
		return 0
	}
	if this.IsIRI() {
		return -2
	}
	return -1
}
func (this W3IDSecurityV1PublicKeyPropertyIterator) LessThan(o vocab.W3IDSecurityV1PublicKeyPropertyIterator) bool {
	if this.IsIRI() && o.IsIRI() {
		return this.iri.String() < o.GetIRI().String()
	} else if this.IsIRI() {
		return true
	} else if o.IsIRI() {
		return false
	}
	if !this.IsW3IDSecurityV1PublicKey() && !o.IsW3IDSecurityV1PublicKey() {
		return false
	} else if this.IsW3IDSecurityV1PublicKey() && !o.IsW3IDSecurityV1PublicKey() {
		return false
	} else if !this.IsW3IDSecurityV1PublicKey() && o.IsW3IDSecurityV1PublicKey() {
		return true
	} else {
		return this.Get().LessThan(o.Get())
	}
}
func (this W3IDSecurityV1PublicKeyPropertyIterator) Name() string {
	if len(this.alias) > 0 {
		return this.alias + ":" + "W3IDSecurityV1PublicKey"
	} else {
		return "W3IDSecurityV1PublicKey"
	}
}
func (this W3IDSecurityV1PublicKeyPropertyIterator) Next() vocab.W3IDSecurityV1PublicKeyPropertyIterator {
	if this.myIdx+1 >= this.parent.Len() {
		return nil
	} else {
		return this.parent.At(this.myIdx + 1)
	}
}
func (this W3IDSecurityV1PublicKeyPropertyIterator) Prev() vocab.W3IDSecurityV1PublicKeyPropertyIterator {
	if this.myIdx-1 < 0 {
		return nil
	} else {
		return this.parent.At(this.myIdx - 1)
	}
}
func (this *W3IDSecurityV1PublicKeyPropertyIterator) Set(v vocab.W3IDSecurityV1PublicKey) {
	this.clear()
	this.w3idsecurityv1PublicKeyMember = v
}
func (this *W3IDSecurityV1PublicKeyPropertyIterator) SetIRI(v *url.URL) {
	this.clear()
	this.iri = v
}
func (this *W3IDSecurityV1PublicKeyPropertyIterator) SetType(t vocab.Type) error {
	if v, ok := t.(vocab.W3IDSecurityV1PublicKey); ok {
		this.Set(v)
		return nil
	}
	return fmt.Errorf("illegal type to set on W3IDSecurityV1PublicKey property: %T", t)
}
func (this *W3IDSecurityV1PublicKeyPropertyIterator) clear() {
	this.unknown = nil
	this.iri = nil
	this.w3idsecurityv1PublicKeyMember = nil
}
func (this W3IDSecurityV1PublicKeyPropertyIterator) serialize() (interface{}, error) {
	if this.IsW3IDSecurityV1PublicKey() {
		return this.Get().Serialize()
	} else if this.IsIRI() {
		return this.iri.String(), nil
	}
	return this.unknown, nil
}
type W3IDSecurityV1PublicKeyProperty struct {
	properties []*W3IDSecurityV1PublicKeyPropertyIterator
	alias      string
}
func DeserializePublicKeyProperty(m map[string]interface{}, aliasMap map[string]string) (vocab.W3IDSecurityV1PublicKeyProperty, error) {
	alias := ""
	if a, ok := aliasMap["https://w3id.org/security/v1"]; ok {
		alias = a
	}
	propName := "publicKey"
	if len(alias) > 0 {
		propName = fmt.Sprintf("%s:%s", alias, "publicKey")
	}
	i, ok := m[propName]
	if ok {
		this := &W3IDSecurityV1PublicKeyProperty{
			alias:      alias,
			properties: []*W3IDSecurityV1PublicKeyPropertyIterator{},
		}
		if list, ok := i.([]interface{}); ok {
			for _, iterator := range list {
				if p, err := deserializeW3IDSecurityV1PublicKeyPropertyIterator(iterator, aliasMap); err != nil {
					return this, err
				} else if p != nil {
					this.properties = append(this.properties, p)
				}
			}
		} else {
			if p, err := deserializeW3IDSecurityV1PublicKeyPropertyIterator(i, aliasMap); err != nil {
				return this, err
			} else if p != nil {
				this.properties = append(this.properties, p)
			}
		}
		for idx, ele := range this.properties {
			ele.parent = this
			ele.myIdx = idx
		}
		return this, nil
	}
	return nil, nil
}
func NewW3IDSecurityV1PublicKeyProperty() *W3IDSecurityV1PublicKeyProperty {
	return &W3IDSecurityV1PublicKeyProperty{alias: ""}
}
func (this *W3IDSecurityV1PublicKeyProperty) AppendIRI(v *url.URL) {
	this.properties = append(this.properties, &W3IDSecurityV1PublicKeyPropertyIterator{
		alias:  this.alias,
		iri:    v,
		myIdx:  this.Len(),
		parent: this,
	})
}
func (this *W3IDSecurityV1PublicKeyProperty) AppendType(t vocab.Type) error {
	n := &W3IDSecurityV1PublicKeyPropertyIterator{
		alias:  this.alias,
		myIdx:  this.Len(),
		parent: this,
	}
	if err := n.SetType(t); err != nil {
		return err
	}
	this.properties = append(this.properties, n)
	return nil
}
func (this *W3IDSecurityV1PublicKeyProperty) AppendW3IDSecurityV1PublicKey(v vocab.W3IDSecurityV1PublicKey) {
	this.properties = append(this.properties, &W3IDSecurityV1PublicKeyPropertyIterator{
		alias:                         this.alias,
		myIdx:                         this.Len(),
		parent:                        this,
		w3idsecurityv1PublicKeyMember: v,
	})
}
func (this W3IDSecurityV1PublicKeyProperty) At(index int) vocab.W3IDSecurityV1PublicKeyPropertyIterator {
	return this.properties[index]
}
func (this W3IDSecurityV1PublicKeyProperty) Begin() vocab.W3IDSecurityV1PublicKeyPropertyIterator {
	if this.Empty() {
		return nil
	} else {
		return this.properties[0]
	}
}
func (this W3IDSecurityV1PublicKeyProperty) Empty() bool {
	return this.Len() == 0
}
func (this W3IDSecurityV1PublicKeyProperty) End() vocab.W3IDSecurityV1PublicKeyPropertyIterator {
	return nil
}
func (this *W3IDSecurityV1PublicKeyProperty) InsertIRI(idx int, v *url.URL) {
	this.properties = append(this.properties, nil)
	copy(this.properties[idx+1:], this.properties[idx:])
	this.properties[idx] = &W3IDSecurityV1PublicKeyPropertyIterator{
		alias:  this.alias,
		iri:    v,
		myIdx:  idx,
		parent: this,
	}
	for i := idx; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
}
func (this *W3IDSecurityV1PublicKeyProperty) InsertType(idx int, t vocab.Type) error {
	n := &W3IDSecurityV1PublicKeyPropertyIterator{
		alias:  this.alias,
		myIdx:  idx,
		parent: this,
	}
	if err := n.SetType(t); err != nil {
		return err
	}
	this.properties = append(this.properties, nil)
	copy(this.properties[idx+1:], this.properties[idx:])
	this.properties[idx] = n
	for i := idx; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
	return nil
}
func (this *W3IDSecurityV1PublicKeyProperty) InsertW3IDSecurityV1PublicKey(idx int, v vocab.W3IDSecurityV1PublicKey) {
	this.properties = append(this.properties, nil)
	copy(this.properties[idx+1:], this.properties[idx:])
	this.properties[idx] = &W3IDSecurityV1PublicKeyPropertyIterator{
		alias:                         this.alias,
		myIdx:                         idx,
		parent:                        this,
		w3idsecurityv1PublicKeyMember: v,
	}
	for i := idx; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
}
func (this W3IDSecurityV1PublicKeyProperty) JSONLDContext() map[string]string {
	m := map[string]string{"https://w3id.org/security/v1": this.alias}
	for _, elem := range this.properties {
		child := elem.JSONLDContext()
		for k, v := range child {
			m[k] = v
		}
	}
	return m
}
func (this W3IDSecurityV1PublicKeyProperty) KindIndex(idx int) int {
	return this.properties[idx].KindIndex()
}
func (this W3IDSecurityV1PublicKeyProperty) Len() (length int) {
	return len(this.properties)
}
func (this W3IDSecurityV1PublicKeyProperty) Less(i, j int) bool {
	idx1 := this.KindIndex(i)
	idx2 := this.KindIndex(j)
	if idx1 < idx2 {
		return true
	} else if idx1 == idx2 {
		if idx1 == 0 {
			lhs := this.properties[i].Get()
			rhs := this.properties[j].Get()
			return lhs.LessThan(rhs)
		} else if idx1 == -2 {
			lhs := this.properties[i].GetIRI()
			rhs := this.properties[j].GetIRI()
			return lhs.String() < rhs.String()
		}
	}
	return false
}
func (this W3IDSecurityV1PublicKeyProperty) LessThan(o vocab.W3IDSecurityV1PublicKeyProperty) bool {
	l1 := this.Len()
	l2 := o.Len()
	l := l1
	if l2 < l1 {
		l = l2
	}
	for i := 0; i < l; i++ {
		if this.properties[i].LessThan(o.At(i)) {
			return true
		} else if o.At(i).LessThan(this.properties[i]) {
			return false
		}
	}
	return l1 < l2
}
func (this W3IDSecurityV1PublicKeyProperty) Name() string {
	if len(this.alias) > 0 {
		return this.alias + ":" + "publicKey"
	} else {
		return "publicKey"
	}
}
func (this *W3IDSecurityV1PublicKeyProperty) PrependIRI(v *url.URL) {
	this.properties = append([]*W3IDSecurityV1PublicKeyPropertyIterator{{
		alias:  this.alias,
		iri:    v,
		myIdx:  0,
		parent: this,
	}}, this.properties...)
	for i := 1; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
}