package cvdata

import (
	"fmt"

	utils "github.com/jesusperez/datautils"
)

type EducationType struct {
	Auth AuthInfoType `yaml:"auth" json:"auth"`
	Date string `yaml:"date" json:"date"`
  Title string `yaml:"title" json:"title"`
  Org string `yaml:"org" json:"org"`
  Location string `yaml:"location" json:"location"`
	Cert string `yaml:"cert" json:"cert"`
  Description []string `yaml:"description" json:"description"`
  Tools []string `yaml:"tools" json:"tools"`
}
type Education struct {
  Education []EducationType `yaml:"education" json:"education"`
}
type ShowEducationType struct {
	Auth AuthInfoType `yaml:"auth" json:"auth"`
	Date bool `yaml:"date" json:"date"`
	Title bool `yaml:"title" json:"title"`
	Org  bool `yaml:"org" json:"org"`
	Location bool `yaml:"location" json:"location"`
	Cert  bool `yaml:"cert" json:"cert"`
	Description bool `yaml:"description" json:"description"`
	Tools bool `yaml:"tools" json:"tools"`
}
func (education *Education)Load(path string) ([]EducationType, error) {
	d,file,errpath := utils.DecoderFromFile(path)
	if errpath != nil {
		return education.Education, errpath
	}
	defer file.Close()
	if err := d.Decode(&education); err != nil {
	 	fmt.Printf("Decode: %v", err)
		return education.Education, err
	}
  return education.Education, nil
}