package apidiff

import (
	
	
	
)

// Report describes the changes detected by Changes.
type Report struct {
	Changes []Change
}

// A Change describes a single API change.
type Change struct {
	Message    string
	Compatible bool
}

func ( Report) ( bool) []string {
	var  []string
	for ,  := range .Changes {
		if .Compatible ==  {
			 = append(, .Message)
		}
	}
	return 
}

func ( Report) () string {
	var  bytes.Buffer
	if  := .Text(&);  != nil {
		return fmt.Sprintf("!!%v", )
	}
	return .String()
}

func ( Report) ( io.Writer) error {
	if  := .TextIncompatible(, true);  != nil {
		return 
	}
	return .TextCompatible()
}

func ( Report) ( io.Writer,  bool) error {
	if  {
		return .writeMessages(, "Incompatible changes:", .messages(false))
	}
	return .writeMessages(, "", .messages(false))
}

func ( Report) ( io.Writer) error {
	return .writeMessages(, "Compatible changes:", .messages(true))
}

func ( Report) ( io.Writer,  string,  []string) error {
	if len() == 0 {
		return nil
	}
	if  != "" {
		if ,  := fmt.Fprintf(, "%s\n", );  != nil {
			return 
		}
	}
	for ,  := range  {
		if ,  := fmt.Fprintf(, "- %s\n", );  != nil {
			return 
		}
	}
	return nil
}