syntax="proto3";

import "google/protobuf/timestamp.proto";
import "gogoproto/gogo.proto";
// import "validate/validate.proto";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";

package api.v1;

option go_package = "moredoc/api/v1;v1";
option java_multiple_files = true;
option java_package = "api.v1";

message Friendlink {
    int32 id = 1;
    string title = 2;
    string link = 3;
    string description = 4;
    int32 sort = 5;
    bool enable = 6;
    google.protobuf.Timestamp created_at = 7 [ (gogoproto.stdtime) = true ];
    google.protobuf.Timestamp updated_at = 8 [ (gogoproto.stdtime) = true ];
}

message DeleteFriendlinkRequest {
    repeated int64       id        = 1;
}

message GetFriendlinkRequest {
    int64 id = 1;
}

message ListFriendlinkRequest {
    int32 page = 1;
    int32 size = 2;
    string wd = 3;
    repeated bool enable = 4;
    repeated string field = 5;
}

message ListFriendlinkReply {
    repeated Friendlink friendlink = 1;
    int64 total = 2;
}

service FriendlinkAPI{
    rpc CreateFriendlink (Friendlink) returns (Friendlink){
        option (google.api.http) = {
            post: '/api/v1/friendlink',
            body: '*',
        };
    }

    rpc UpdateFriendlink (Friendlink) returns (google.protobuf.Empty) {
        option (google.api.http) = {
            put: '/api/v1/friendlink',
            body: '*',
        };
    }

    rpc DeleteFriendlink (DeleteFriendlinkRequest) returns (google.protobuf.Empty){
        option (google.api.http) = {
            delete: '/api/v1/friendlink',
        };
    }

    rpc GetFriendlink (GetFriendlinkRequest) returns (Friendlink){
        option (google.api.http) = {
            get: '/api/v1/friendlink',
        };
    }

    rpc ListFriendlink (ListFriendlinkRequest) returns (ListFriendlinkReply){
        option (google.api.http) = {
            get: '/api/v1/friendlink/list',
        };
    }
}