syntax = "proto3"; package competition; import "google/protobuf/timestamp.proto"; import "google/protobuf/empty.proto"; option go_package = "pkg/api/competition"; service CompetitionService { rpc GetCompetition(GetCompetitionRequest) returns (Competition); rpc ListCompetitions(ListCompetitionsRequest) returns (ListCompetitionsResponse); rpc ChangeCompetitionState(ChangeCompetitionStateRequest) returns (Competition); } enum CompetitionState { COMPETITION_STATE_UNSPECIFIED = 0; COMPETITION_STATE_DRAFT = 1; COMPETITION_STATE_NOT_STARTED = 2; COMPETITION_STATE_STARTED = 3; COMPETITION_STATE_FINISHED = 4; COMPETITION_STATE_ARCHIVED = 5; } enum ParticipationType { PARTICIPATION_TYPE_UNSPECIFIED = 0; PARTICIPATION_TYPE_INDIVIDUAL = 1; PARTICIPATION_TYPE_TEAM = 2; } enum CompetitionType { COMPETITION_TYPE_UNSPECIFIED = 0; COMPETITION_TYPE_EDUCATIVE = 1; COMPETITION_TYPE_COMPETETIVE = 2; } message Competition { string id = 1; CompetitionState state = 2; string title = 3; string description = 4; optional string image_url = 5; google.protobuf.Timestamp start_time = 6; google.protobuf.Timestamp end_time = 7; CompetitionType type = 8; ParticipationType participation_type = 9; google.protobuf.Timestamp created_at = 10; google.protobuf.Timestamp updated_at = 11; } message GetCompetitionRequest { string competition_id = 1; } message ListCompetitionsRequest { int32 page_size = 1; int32 page_token = 2; optional CompetitionState state = 3; optional bool is_participating = 4; optional string search_query = 5; } message ListCompetitionsResponse { int32 total_count = 2; int32 next_page_token = 3; repeated Competition competitions = 1; } message ChangeCompetitionStateRequest { string competition_id = 1; CompetitionState state = 2; }