package jen

import (
	
	
	
)

// Dict renders as key/value pairs. Use with Values for map or composite
// literals.
type Dict map[Code]Code

// DictFunc executes a func(Dict) to generate the value. Use with Values for
// map or composite literals.
func ( func(Dict)) Dict {
	 := Dict{}
	()
	return 
}

func ( Dict) ( *File,  io.Writer,  *Statement) error {
	 := true
	// must order keys to ensure repeatable source
	type  struct {
		 Code
		 Code
	}
	 := map[string]{}
	 := []string{}
	for ,  := range  {
		if .isNull() || .isNull() {
			continue
		}
		 := &bytes.Buffer{}
		if  := .render(, , nil);  != nil {
			return 
		}
		 = append(, .String())
		[.String()] = {: , : }
	}
	sort.Strings()
	for ,  := range  {
		 := [].
		 := [].
		if  && len() > 1 {
			if ,  := .Write([]byte("\n"));  != nil {
				return 
			}
			 = false
		}
		if  := .render(, , nil);  != nil {
			return 
		}
		if ,  := .Write([]byte(":"));  != nil {
			return 
		}
		if  := .render(, , nil);  != nil {
			return 
		}
		if len() > 1 {
			if ,  := .Write([]byte(",\n"));  != nil {
				return 
			}
		}
	}
	return nil
}

func ( Dict) ( *File) bool {
	if  == nil || len() == 0 {
		return true
	}
	for ,  := range  {
		if !.isNull() && !.isNull() {
			// if any of the key/value pairs are both not null, the Dict is not
			// null
			return false
		}
	}
	return true
}