syntax = "proto3";
package paralus.dev.rpc.system.v3;

import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "proto/types/systempb/v3/project.proto";

option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
  info : {
    title : "Project Service"
    version : "3.0"
    contact : {name : "Paralus Dev"}
  }
  schemes : HTTPS
  consumes : "application/json"
  consumes : "application/yaml"
  produces : "application/json"
  produces : "application/yaml"
  security_definitions : {
    security : {
      key : "BasicAuth"
      value : {type : TYPE_BASIC}
    }
    security : {
      key : "ApiKeyAuth"
      value : {type : TYPE_API_KEY in : IN_HEADER name : "X-API-KEYID"}
    }
    security : {
      key : "ApiTokenAuth"
      value : {
        type : TYPE_API_KEY in : IN_HEADER name : "X-API-TOKEN"
      }
    }
  }
  security : {
    security_requirement : {
      key : "BasicAuth"
      value : {}
    }
    security_requirement : {
      key : "ApiKeyAuth"
      value : {}
    }
    security_requirement : {
      key : "ApiTokenAuth"
      value : {}
    }
  }
  responses : {
    key : "403"
    value : {
      description : "Returned when the user does not have permission to access "
                    "the resource."
    }
  }
  responses : {
    key : "404"
    value : {
      description : "Returned when the resource does not exist."
      schema : {json_schema : {type : STRING}}
    }
  }
};

service ProjectService {
    rpc CreateProject(paralus.dev.types.system.v3.Project)
        returns (paralus.dev.types.system.v3.Project) {
      option (google.api.http) = {
        post : "/auth/v3/partner/{metadata.partner}/organization/{metadata.organization}/project"
        body : "*"
      };
  
      option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
        responses : {
          key : "201"
          value : {
            description : "Returned when project is created successfully."
          }
        }
      };
    };
  
    rpc GetProjects(paralus.dev.types.system.v3.Project)
        returns (paralus.dev.types.system.v3.ProjectList) {
      option (google.api.http) = {
        get : "/auth/v3/partner/{metadata.partner}/organization/{metadata.organization}/projects"
      };
    };
  
    rpc GetProject(paralus.dev.types.system.v3.Project)
        returns (paralus.dev.types.system.v3.Project) {
      option (google.api.http) = {
        get : "/auth/v3/partner/{metadata.partner}/organization/{metadata.organization}/project/"
              "{metadata.name}"
      };
    };
  
    rpc UpdateProject(paralus.dev.types.system.v3.Project)
        returns (paralus.dev.types.system.v3.Project) {
      option (google.api.http) = {
        put : "/auth/v3/partner/{metadata.partner}/organization/{metadata.organization}/project/"
              "{metadata.name}"
        body : "*"
      };
    };
  
    rpc DeleteProject(paralus.dev.types.system.v3.Project)
        returns (paralus.dev.types.system.v3.Project) {
      option (google.api.http) = {
        delete : "/auth/v3/partner/{metadata.partner}/organization/{metadata.organization}/project/"
                 "{metadata.name}"
      };
  
      option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
        responses : {
          key : "204"
          value : {
            description : "Returned when project is deleted successfully."
          }
        }
      };
    };
  
  }