// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.

package tangled

// schema: sh.tangled.git.temp.analyzeMerge

import (
	"context"

	"github.com/bluesky-social/indigo/lex/util"
)

const (
	GitTempAnalyzeMergeNSID = "sh.tangled.git.temp.analyzeMerge"
)

// GitTempAnalyzeMerge_ConflictInfo is a "conflictInfo" in the sh.tangled.git.temp.analyzeMerge schema.
type GitTempAnalyzeMerge_ConflictInfo struct {
	// filename: Name of the conflicted file
	Filename string `json:"filename" cborgen:"filename"`
	// reason: Reason for the conflict
	Reason string `json:"reason" cborgen:"reason"`
}

// GitTempAnalyzeMerge_Output is the output of a sh.tangled.git.temp.analyzeMerge call.
type GitTempAnalyzeMerge_Output struct {
	// conflicts: List of files with merge conflicts
	Conflicts []*GitTempAnalyzeMerge_ConflictInfo `json:"conflicts,omitempty" cborgen:"conflicts,omitempty"`
	// is_conflicted: Whether the merge has conflicts
	Is_conflicted bool `json:"is_conflicted" cborgen:"is_conflicted"`
}

// GitTempAnalyzeMerge calls the XRPC method "sh.tangled.git.temp.analyzeMerge".
//
// branch: Target branch to merge into
// patch: Patch or pull request to check for merge conflicts
// repo: AT-URI of the repository
func GitTempAnalyzeMerge(ctx context.Context, c util.LexClient, branch string, patch string, repo string) (*GitTempAnalyzeMerge_Output, error) {
	var out GitTempAnalyzeMerge_Output

	params := map[string]interface{}{}
	params["branch"] = branch
	params["patch"] = patch
	params["repo"] = repo
	if err := c.LexDo(ctx, util.Query, "", "sh.tangled.git.temp.analyzeMerge", params, nil, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
