syntax = "proto3";

package stream.app.v1;

option go_package = "stream.api/internal/gen/proto/app/v1;appv1";

import "app/v1/common.proto";

service VideosService {
  rpc GetUploadUrl(GetUploadUrlRequest) returns (GetUploadUrlResponse);
  rpc CreateVideo(CreateVideoRequest) returns (CreateVideoResponse);
  rpc ListVideos(ListVideosRequest) returns (ListVideosResponse);
  rpc GetVideo(GetVideoRequest) returns (GetVideoResponse);
  rpc UpdateVideo(UpdateVideoRequest) returns (UpdateVideoResponse);
  rpc DeleteVideo(DeleteVideoRequest) returns (MessageResponse);
}

message GetUploadUrlRequest {
  string filename = 1;
}

message GetUploadUrlResponse {
  string upload_url = 1;
  string key = 2;
  string file_id = 3;
}

message CreateVideoRequest {
  string title = 1;
  optional string description = 2;
  string url = 3;
  int64 size = 4;
  int32 duration = 5;
  optional string format = 6;
}

message CreateVideoResponse {
  Video video = 1;
}

message ListVideosRequest {
  int32 page = 1;
  int32 limit = 2;
  optional string search = 3;
  optional string status = 4;
}

message ListVideosResponse {
  repeated Video videos = 1;
  int64 total = 2;
  int32 page = 3;
  int32 limit = 4;
}

message GetVideoRequest {
  string id = 1;
}

message GetVideoResponse {
  Video video = 1;
}

message UpdateVideoRequest {
  string id = 1;
  string title = 2;
  optional string description = 3;
  string url = 4;
  int64 size = 5;
  int32 duration = 6;
  optional string format = 7;
  optional string status = 8;
}

message UpdateVideoResponse {
  Video video = 1;
}

message DeleteVideoRequest {
  string id = 1;
}
