package main

import (
	"bytes"
	"encoding/json"
	"fmt"
)

type tweet struct {
	topicPointer string
	textPointer  int
	Text         string
	Topics       []string
}

var topicList []string

func test() {
	topicList = append(topicList, "Sport", "Ball", "Kick")
	fmt.Println(topicList[0])
	topicByteArray := new(bytes.Buffer)
	json.NewEncoder(topicByteArray).Encode(topicList)
	fmt.Println(topicByteArray.String())

	var recBookmark []string
	arrayReader := bytes.NewReader(topicByteArray.Bytes())
	json.NewDecoder(arrayReader).Decode(&recBookmark)

	fmt.Println(recBookmark)

	var tweets []tweet
	tweet1 := tweet{"", 0, "Let's go", topicList}
	tweet2 := tweet{"", 0, "HeyHo", topicList}
	tweets = append(tweets, tweet1, tweet2)

	tweetByteArray := new(bytes.Buffer)
	json.NewEncoder(tweetByteArray).Encode(tweets)
	fmt.Println(tweetByteArray.String())

	var recTweets []tweet
	tweetReader := bytes.NewReader(tweetByteArray.Bytes())
	json.NewDecoder(tweetReader).Decode(&recTweets)
	fmt.Println(recTweets[0].Text)

}
