// Copyright 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

package google.cloud.talent.v4beta1;

import "google/api/annotations.proto";
import "google/cloud/talent/v4beta1/profile.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent";
option java_multiple_files = true;
option java_outer_classname = "ResumeServiceProto";
option java_package = "com.google.cloud.talent.v4beta1";
option objc_class_prefix = "CTS";


// A service that handles resume parsing.
service ResumeService {
  // Parses a resume into a [Profile][google.cloud.talent.v4beta1.Profile]. The API attempts to fill out the
  // following profile fields if present within the resume:
  //
  // * personNames
  // * addresses
  // * emailAddress
  // * phoneNumbers
  // * personalUris
  // * employmentRecords
  // * educationRecords
  // * skills
  //
  // Note that some attributes in these fields may not be populated if they're
  // not present within the resume or unrecognizable by the resume parser.
  //
  // This API does not save the resume or profile. To create a profile from this
  // resume, clients need to call the CreateProfile method again with the
  // profile returned.
  //
  // This API supports the following list of formats:
  //
  // * PDF
  // * TXT
  // * DOC
  // * RTF
  // * DOCX
  //
  // An error is thrown if the input format is not supported.
  rpc ParseResume(ParseResumeRequest) returns (ParseResumeResponse) {
    option (google.api.http) = {
      post: "/v4beta1/{parent=projects/*}/resumes:parse"
      body: "*"
    };
  }
}

// Parse resume request.
message ParseResumeRequest {
  // Required.
  //
  // The resource name of the project.
  //
  // The format is "projects/{project_id}", for example,
  // "projects/api-test-project".
  string parent = 1;

  // Required.
  //
  // The bytes of the resume file in common format. Currently the API supports
  // the following formats:
  // PDF, TXT, DOC, RTF and DOCX.
  bytes resume = 2;

  // Optional.
  //
  // The region code indicating where the resume is from. Values
  // are as per the ISO-3166-2 format. For example, US, FR, DE.
  //
  // This value is optional, but providing this value improves the resume
  // parsing quality and performance.
  //
  // An error is thrown if the regionCode is invalid.
  string region_code = 3;

  // Optional.
  //
  // The language code of contents in the resume.
  //
  // Language codes must be in BCP-47 format, such as "en-US" or "sr-Latn".
  // For more information, see
  // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47){:
  // class="external" target="_blank" }.
  string language_code = 4;
}

// Parse resume response.
message ParseResumeResponse {
  // The profile parsed from resume.
  Profile profile = 1;

  // Raw text from resume.
  string raw_text = 2;
}
