syntax = "proto3";
option go_package = "go.sour.is/lextwt-proto/pb";


service TwtRegistryService {
  rpc latestTwts (LatestTwts) returns (TwtRegistry);
}

message LatestTwts {}

message TwtRegistry {
  repeated Comment preamble = 1;
  repeated Twter twters = 2;
  repeated Twt twts = 3;
}

message BangMention {
    string name = 1;
    string target = 2;
}

message Code {
    enum Type {
        CODE_UNSPECIFIED = 0;
        CODE_INLINE = 1;
        CODE_BLOCK = 2;
    }

    Type type = 1;
    string code = 2;
}

message Comment {
    string comment = 1;
    string key = 2;
    string value = 3;
}

message DateTime {
    int64 timestamp = 1;
    int32 offset = 2;
    string zone = 3;
}

message LineSeparator {}

message Link {
    enum Type {
        LINK_UNSPECIFIED = 0;
        LINK_STANDARD = 1;
        LINK_MEDIA = 2;
        LINK_PLAIN = 3;
        LINK_NAKED = 4;
    }

    Type type = 1;
    string alt = 2;
    string target = 3;
    string title = 4;
}

message Mention {
    string name = 1;
    string target = 2;
}

message Subject {
    string subject = 1;
    Tag tag = 2;
}

message Tag {
    string tag = 1;
    string target = 2;
}

message Text {
    string text = 1;
}

message Twter {
    string nick = 1;
    string uri = 2;
}

message Elem {
    oneof elem {
        BangMention bangmention = 1;
        Code code = 2;
        Comment comment = 3;
        LineSeparator lineseparator = 4;
        Link link = 5;
        Mention mention = 6;
        Subject subject = 7;
        Tag tag = 8;
        Text text = 9;
    };
}

message Twt {
    Twter twter = 1;
    DateTime created = 2;
    repeated Elem msg = 3;
}
