channel addAccounts {
    out accounts(accounts: Map, addAccounts(aid: Str, name: Str)) = insert(accounts, aid, {"name": name})
}

channel changeNameOfAccounts(aid: Str) {
    out accounts.{aid}.name(name: Str, changeNameOfAccounts(newName: Str)) = newName
}

channel addTweets {
    out tweets(tweets: Map, addTweets(tid: Str, contents: Str, aidOfAccountName: Str)) = insert(tweets, tid, {"contents": contents,"aidOfAccountName": aidOfAccountName})
}

channel changeContentsOfTweets(tid: Str) {
    out tweets.{tid}.contents(contents: Str, changeContentsOfTweets(newContents: Str)) = newContents
}

channel changeAidOfAccountNameOfTweets(tid: Str) {
    out tweets.{tid}.aidOfAccountName(aidOfAccountName: Str, changeAidOfAccountNameOfTweets(newAidOfAccountName: Str)) = newAidOfAccountName
}

channel nameOfAccountNameOfTweets(tid: Str){
    in tweets.{tid}.aidOfAccountName(aidOfAccountName: Str, nameOfAccountNameOfTweets(newAidOfAccountName: Str, newNameOfAccountName: Str)) = newAidOfAccountName
    in accounts.{newAidOfAccountName}.name(name: Str, nameOfAccountNameOfTweets(newAidOfAccountName, newNameOfAccountName)) = newNameOfAccountName
    out tweets.{tid}.nameOfAccountName(nameOfAccountName, nameOfAccountNameOfTweets(newAidOfAccountName, newNameOfAccountName)) = newNameOfAccountName
} 

channel addFollow {
    out follow(follow: Map, addFollow(fid: Str, aidOfFollower: Str, aidOfFollowee: Str)) = insert(follow, fid, {"aidOfFollower": aidOfFollower,"aidOfFollowee": aidOfFollowee})
}

channel changeAidOfFollowerOfFollow(fid: Str) {
    out follow.{fid}.aidOfFollower(aidOfFollower: Str, changeAidOfFollowerOfFollow(newAidOfFollower: Str)) = newAidOfFollower
}

channel nameOfFollowerOfFollow(fid: Str){
    in follow.{fid}.aidOfFollower(aidOfFollower: Str, nameOfFollowerOfFollow(newAidOfFollower: Str, newNameOfFollower: Str)) = newAidOfFollower
    in accounts.{newAidOfFollower}.name(name: Str, nameOfFollowerOfFollow(newAidOfFollower, newNameOfFollower)) = newNameOfFollower
    out follow.{fid}.nameOfFollower(nameOfFollower, nameOfFollowerOfFollow(newAidOfFollower, newNameOfFollower)) = newNameOfFollower
} 

channel changeAidOfFolloweeOfFollow(fid: Str) {
    out follow.{fid}.aidOfFollowee(aidOfFollowee: Str, changeAidOfFolloweeOfFollow(newAidOfFollowee: Str)) = newAidOfFollowee
}

channel nameOfFolloweeOfFollow(fid: Str){
    in follow.{fid}.aidOfFollowee(aidOfFollowee: Str, nameOfFolloweeOfFollow(newAidOfFollowee: Str, newNameOfFollowee: Str)) = newAidOfFollowee
    in accounts.{newAidOfFollowee}.name(name: Str, nameOfFolloweeOfFollow(newAidOfFollowee, newNameOfFollowee)) = newNameOfFollowee
    out follow.{fid}.nameOfFollowee(nameOfFollowee, nameOfFolloweeOfFollow(newAidOfFollowee, newNameOfFollowee)) = newNameOfFollowee
} 


