package main

import (
	"fmt"
	"net/url"
)

type User struct {
	ID    int
	First string
	Last  string
}

func (u User) Slug() string {
	return url.PathEscape(fmt.Sprintf("%d-%s-%s", u.ID, u.First, u.Last))
}

// #TODO:
// Satisfy the stringer interface (https://golang.org/pkg/fmt/#Stringer)
// so that the User struct will print
// User <ID> is <First> <Last>
//
// example:
//      User 1 is Rob Pike

type Product struct {
	ID   int
	Name string
}

// #TODO:
// Satisfy the stringer interface (https://golang.org/pkg/fmt/#Stringer)
// so that the Product struct will print
// Product <ID> is <Name>
//
// example:
//      User 1 is Rob Pike

func (p Product) Slug() string {
	return url.PathEscape(fmt.Sprintf("%d-%s", p.ID, p.Name))
}

// #TODO: Create an interface called `Slugger` that matches the behavior of the
//  `Slug` function that both the Product and User type have declared

func main() {
	u := User{ID: 1, First: "Rob", Last: "Pike"}
	fmt.Println(u)

	p := Product{ID: 10, Name: "Plush Gopher"}
	fmt.Println(p)

	// #TODO: Declare a slice of `Slugger` and add the previously declared user and product to the slice

	for _, s := range sluggers {
		// #TODO: Print out the `Slug` for each item

	}
}
