syntax = "proto3";

package pragma.custom;

import "pragmaOptions.proto";

option (pragma.backend_type) = GAME;

/*
 * Operator request to commit the local content/src and content/package directories to a
 * GitHub repository. The commit is based on the git sha embedded in the deployed Content
 * artifact's version.json (or the configured local-dev fallback branch tip when running
 * locally). A new temp branch is created and a PR is opened targeting the configured
 * branchName.
 */
message CommitContentToGithubOperatorV1Request {
    option (pragma.pragma_session_type) = OPERATOR;
    option (pragma.pragma_message_type) = REQUEST;

    // Optional. Falls back to "Content update <timestamp>" when blank.
    string pr_title = 1;
    // Optional. Free-form body added to the PR description.
    string pr_body = 2;
}

/*
 * Response containing the created PR's URL plus branch / commit metadata for the operator.
 */
message CommitContentToGithubOperatorV1Response {
    option (pragma.pragma_session_type) = OPERATOR;
    option (pragma.pragma_message_type) = RESPONSE;

    string pull_request_url = 1;
    string branch_name = 2;
    string commit_sha = 3;
    string base_sha = 4;
}

/*
 * Operator request used by the portal to decide whether to surface the "Commit to GitHub" UI.
 * Returns true only when all required config (repositoryUrl, githubTokenSecret, contentRepoPath)
 * is populated (non-blank and not the "UNCONFIGURED" sentinel).
 */
message IsCustomContentGithubServiceConfiguredOperatorV1Request {
    option (pragma.pragma_session_type) = OPERATOR;
    option (pragma.pragma_message_type) = REQUEST;
}

message IsCustomContentGithubServiceConfiguredOperatorV1Response {
    option (pragma.pragma_session_type) = OPERATOR;
    option (pragma.pragma_message_type) = RESPONSE;

    bool configured = 1;
}

message CustomContentGithubServiceApplicationError {
    string message = 1;
}