package runtime

import (
	
	
	
)

func getTag( reflect.StructField) string {
	return .Tag.Get("json")
}

func ( reflect.StructField) bool {
	if .PkgPath != "" {
		if .Anonymous {
			 := .Type
			if .Kind() == reflect.Ptr {
				 = .Elem()
			}
			if .Kind() != reflect.Struct {
				return true
			}
		} else {
			// private field
			return true
		}
	}
	 := getTag()
	return  == "-"
}

type StructTag struct {
	Key         string
	IsTaggedKey bool
	IsOmitEmpty bool
	IsString    bool
	Field       reflect.StructField
}

type StructTags []*StructTag

func ( StructTags) ( string) bool {
	for ,  := range  {
		if .Key ==  {
			return true
		}
	}
	return false
}

func isValidTag( string) bool {
	if  == "" {
		return false
	}
	for ,  := range  {
		switch {
		case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", ):
			// Backslash and quote chars are reserved, but
			// otherwise any punctuation chars are allowed
			// in a tag name.
		case !unicode.IsLetter() && !unicode.IsDigit():
			return false
		}
	}
	return true
}

func ( reflect.StructField) *StructTag {
	 := .Name
	 := getTag()
	 := &StructTag{Field: }
	 := strings.Split(, ",")
	if len() > 0 {
		if [0] != "" && isValidTag([0]) {
			 = [0]
			.IsTaggedKey = true
		}
	}
	.Key = 
	if len() > 1 {
		for ,  := range [1:] {
			switch  {
			case "omitempty":
				.IsOmitEmpty = true
			case "string":
				.IsString = true
			}
		}
	}
	return 
}