func (c *Card) MarshalJSON() ([]byte, error) {
	if err := c.Validate(); err != nil {
		return nil, errors.Wrap(err, "validation error")
	}
	doc := struct {
		cardAlias
		Type        string     `json:"type"`
		Suspended   *bool      `json:"suspended,omitempty"`
		Imported    *time.Time `json:"imported,omitempty"`
		LastReview  *time.Time `json:"lastReview,omitempty"`
		Due         *Due       `json:"due,omitempty"`
		BuriedUntil *Due       `json:"buriedUntil,omitempty"`
	}{
		Type:      "card",
		cardAlias: cardAlias(*c),
	}
	if c.Suspended {
		doc.Suspended = &c.Suspended
	}
	if !c.Imported.IsZero() {
		doc.Imported = &c.Imported
	}
	if !c.BuriedUntil.IsZero() {
		doc.BuriedUntil = &c.BuriedUntil
	}
	if !c.Due.IsZero() {
		doc.Due = &c.Due
	}
	if !c.LastReview.IsZero() {
		doc.LastReview = &c.LastReview
	}
	j, err := json.Marshal(doc)
	return j, err
}
// MarshalJSON implements the json.Marshaler interface for the Card type.
MarshalJSON implements the json.Marshaler interface for the Card type.
// MarshalJSON implements the json . Marshaler interface for the Card type .
func (c *Card) MarshalJSON() ([]byte, error) {
	if err := c.Validate(); err != nil {
		return nil, errors.Wrap(err, "validation error")
	}
	doc := struct {
		cardAlias
		Type        string     `json:"type"`
		Suspended   *bool      `json:"suspended,omitempty"`
		Imported    *time.Time `json:"imported,omitempty"`
		LastReview  *time.Time `json:"lastReview,omitempty"`
		Due         *Due       `json:"due,omitempty"`
		BuriedUntil *Due       `json:"buriedUntil,omitempty"`
	}{
		Type:      "card",
		cardAlias: cardAlias(*c),
	}
	if c.Suspended {
		doc.Suspended = &c.Suspended
	}
	if !c.Imported.IsZero() {
		doc.Imported = &c.Imported
	}
	if !c.BuriedUntil.IsZero() {
		doc.BuriedUntil = &c.BuriedUntil
	}
	if !c.Due.IsZero() {
		doc.Due = &c.Due
	}
	if !c.LastReview.IsZero() {
		doc.LastReview = &c.LastReview
	}
	j, err := json.Marshal(doc)
	return j, err
}
func ( c * Card ) MarshalJSON ( ) ( [ ] byte , error ) { if err := c . Validate ( ) ; err != nil { return nil , errors . Wrap ( err , " " ) } doc := struct { cardAlias Type string `json:"type"` Suspended * bool `json:"suspended,omitempty"` Imported * time . Time `json:"imported,omitempty"` LastReview * time . Time `json:"lastReview,omitempty"` Due * Due `json:"due,omitempty"` BuriedUntil * Due `json:"buriedUntil,omitempty"` } { Type : " " , cardAlias : cardAlias ( * c ) , } if c . Suspended { doc . Suspended = & c . Suspended } if ! c . Imported . IsZero ( ) { doc . Imported = & c . Imported } if ! c . BuriedUntil . IsZero ( ) { doc . BuriedUntil = & c . BuriedUntil } if ! c . Due . IsZero ( ) { doc . Due = & c . Due } if ! c . LastReview . IsZero ( ) { doc . LastReview = & c . LastReview } j , err := json . Marshal ( doc ) return j , err }
MarshalJSON implements the json.Marshaler interface for the Card type.
MarshalJSON implements the json . Marshaler interface for the Card type .