syntax = "proto3";

package contract;

import "public_messages.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/duration.proto";  
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";

option csharp_namespace = "CMSMicroservice.Protobuf.Protos.Contract";

service ContractContract
{
    rpc CreateNewContract(CreateNewContractRequest) returns (CreateNewContractResponse){
        option (google.api.http) = {
            post: "/CreateNewContract"
            body: "*"
        };
    };
    rpc UpdateContract(UpdateContractRequest) returns (google.protobuf.Empty){
        option (google.api.http) = {
            put: "/UpdateContract"
            body: "*"
        };
    };
    rpc DeleteContract(DeleteContractRequest) returns (google.protobuf.Empty){
        option (google.api.http) = {
            delete: "/DeleteContract"
            body: "*"
        };
    };
    rpc GetContract(GetContractRequest) returns (GetContractResponse){
        option (google.api.http) = {
            get: "/GetContract"
            
        };
    };
    rpc GetAllContractByFilter(GetAllContractByFilterRequest) returns (GetAllContractByFilterResponse){
        option (google.api.http) = {
            get: "/GetAllContractByFilter"
            
        };
    };
}
message CreateNewContractRequest
{
    string title = 1;
    string description = 2;
    string html_content = 3;
    oneof Type_item 
    {
        messages.ContractType type = 4;
    }
}
message CreateNewContractResponse
{
    int64 id = 1;
}
message UpdateContractRequest
{
    int64 id = 1;
    string title = 2;
    string description = 3;
    string html_content = 4;
    oneof Type_item 
    {
        messages.ContractType type = 5;
    }
}
message DeleteContractRequest
{
    int64 id = 1;
}
message GetContractRequest
{
    int64 id = 1;
}
message GetContractResponse
{
    int64 id = 1;
    string title = 2;
    string description = 3;
    string html_content = 4;
    oneof Type_item 
    {
        messages.ContractType type = 5;
    }
}
message GetAllContractByFilterRequest
{
    messages.PaginationState pagination_state = 1;
    google.protobuf.StringValue sort_by = 2;
    GetAllContractByFilterFilter filter = 3;
}
message GetAllContractByFilterFilter
{
    google.protobuf.Int64Value id = 1;
    google.protobuf.StringValue title = 2;
    google.protobuf.StringValue description = 3;
    google.protobuf.StringValue html_content = 4;
    oneof Type_item 
    {
        messages.ContractType type = 5;
    }
}
message GetAllContractByFilterResponse
{
    messages.MetaData meta_data = 1;
    repeated GetAllContractByFilterResponseModel models = 2;
}
message GetAllContractByFilterResponseModel
{
    int64 id = 1;
    string title = 2;
    string description = 3;
    string html_content = 4;
    oneof Type_item 
    {
        messages.ContractType type = 5;
    }
}
