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

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

channel changeAgeOfAccounts(id: Str) {
    out accounts.{id}.age(age: Int, changeAgeOfAccounts(newAge: Int)) = newAge
}

channel addTweets {
    out tweets(tweets: Map, addTweets(tweetId: Int, contents: Str, idOfAccounts: Str)) = insert(tweets, tweetId, {"contents": contents,"idOfAccounts": idOfAccounts})
}

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

channel changeIdOfAccountsOfTweets(tweetId: Int) {
    out tweets.{tweetId}.idOfAccounts(idOfAccounts: Str, changeIdOfAccountsOfTweets(newIdOfAccounts: Str)) = newIdOfAccounts
}

channel nameOfAccountsOfTweets(tweetId: Int){
    in tweets.{tweetId}.idOfAccounts(idOfAccounts: Str, nameOfAccountsOfTweets(newIdOfAccounts: Str, newNameOfAccounts: Str)) = newIdOfAccounts
    in accounts.{newIdOfAccounts}.name(name: Str, nameOfAccountsOfTweets(newIdOfAccounts, newNameOfAccounts)) = newNameOfAccounts
    out tweets.{tweetId}.nameOfAccounts(nameOfAccounts, nameOfAccountsOfTweets(newIdOfAccounts, newNameOfAccounts)) = newNameOfAccounts
} 

channel ageOfAccountsOfTweets(tweetId: Int){
    in tweets.{tweetId}.idOfAccounts(idOfAccounts: Str, ageOfAccountsOfTweets(newIdOfAccounts: Str, newAgeOfAccounts: Int)) = newIdOfAccounts
    in accounts.{newIdOfAccounts}.age(age: Int, ageOfAccountsOfTweets(newIdOfAccounts, newAgeOfAccounts)) = newAgeOfAccounts
    out tweets.{tweetId}.ageOfAccounts(ageOfAccounts, ageOfAccountsOfTweets(newIdOfAccounts, newAgeOfAccounts)) = newAgeOfAccounts
} 


