syntax = "proto3";
import "public.proto";

package pcds.course.v1;

/*
 * 课程服务
 */
service Course{
	rpc GetCourseListForStudio (CourseListRequest) returns (CourseListReply){}
	rpc GetCourseListForCourse (CourseListRequest) returns (CourseListReply){}
	rpc GetCourse (CourseRequest) returns (CourseReply){}
	rpc SetCourse (CourseRequest) returns (CourseReply){}
	rpc AddCourse (CourseRequest) returns (CourseReply){}
	rpc DelCourse (CourseRequest) returns (CourseReply){}
}

message CourseListRequest{
	string Id = 1;
	string Search = 3;
	EnumAllowingSearch SearchCol = 4;
	int32  CurrentPage = 5; //current page number
	int32  PerPage = 6; //The number of items to be shown per page.
	EnumAllowingOrderby OrderBy = 7;
	bool   Desc = 8;
}

enum EnumAllowingSearch{
	EAS_TITLE = 0;
}
enum EnumAllowingOrderby{
	EAO_START_AT =  0;
	EAO_TITLE =  1;
}

message CourseRequest{
	string Id        = 1;
	string Title     = 2;
	string Subtitle  = 3;
	string Summary   = 4;
	string Cover     = 5;
	string Content   = 6;
	EnumContentType ContentType = 7;
	string Html = 8;
	string StartAt     = 9;
	string EndAt       = 10;
	repeated Tag Tags = 11;

	string Lang = 51;
	string EditorId = 52;
	EnumPublicity Publicity = 53;

	string CreatedAt = 101;
	string UpdatedAt = 102;
}
message CourseList{
	string Id = 1;
	string Title = 2;
	string Subtitle = 3;
	string Summary = 4;
	string   Start = 5;
	string   End   = 6;
	string Cover = 7;
	int32  Children = 8;
}

message CourseReply{
	bool ok = 1;
	string message = 2;
	CourseRequest data = 3;
}

message CourseListReply{
	bool ok = 1;
	string message = 2;
	message data{
		repeated CourseList rows = 1;
		int32    Count = 2;
		int32    PageNo = 3;
		int32    PageSize = 4;
	}
}
