namespace lextwt;

table TwtRegistry {
    preamble:[Comment];
    twters:[Twter];
    twts:[Twt];
}

enum LinkType : byte {
    Standard = 1,
    Media,
    Plain,
    Naked
}

enum CodeType : byte {
    Inline = 1,
    Block
}

table Twter {
    nick:string;
    uri:string;
}

table DateTime {
    timestamp:long;
    offset:short;
}

union Elem {
    Comment,
    Mention,
    BangMention,
    Tag,
    Subject,
    Text,
    LineSeparator,
    Link,
    Code,
}

table Msg {
    elem:Elem;
}

table Twt {
    twter:Twter;
    created:DateTime;
    msg:[Msg];
}

table Comment {
    comment:string;
    key:string;
    value:string;
}

table Mention {
    name: string;
    target:string;
}

table BangMention {
    name:string;
    target:string;
}

table Tag {
    tag:string;
    target:string;
}

table Subject {
    subject:string;
    tag:Tag;
}

table Text {
    text:string;
}

table LineSeparator {}

table Link {
    type:LinkType = Standard;
    alt:string;
    target:string;
    title:string;
}

table Code {
    type:CodeType = Inline;
    code:string;
}