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

package tangled

// schema: sh.tangled.repo.mergeCheck

import (
	"context"

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

const (
	RepoMergeCheckNSID = "sh.tangled.repo.mergeCheck"
)

// RepoMergeCheck_ConflictInfo is a "conflictInfo" in the sh.tangled.repo.mergeCheck schema.
type RepoMergeCheck_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"`
}

// RepoMergeCheck_Input is the input argument to a sh.tangled.repo.mergeCheck call.
type RepoMergeCheck_Input struct {
	// branch: Target branch to merge into
	Branch string `json:"branch" cborgen:"branch"`
	// did: DID of the repository owner
	Did string `json:"did" cborgen:"did"`
	// name: Name of the repository
	Name string `json:"name" cborgen:"name"`
	// patch: Patch or pull request to check for merge conflicts
	Patch string `json:"patch" cborgen:"patch"`
	// repo: DID of the repository
	Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"`
}

// RepoMergeCheck_Output is the output of a sh.tangled.repo.mergeCheck call.
type RepoMergeCheck_Output struct {
	// conflicts: List of files with merge conflicts
	Conflicts []*RepoMergeCheck_ConflictInfo `json:"conflicts,omitempty" cborgen:"conflicts,omitempty"`
	// error: Error message if check failed
	Error *string `json:"error,omitempty" cborgen:"error,omitempty"`
	// is_conflicted: Whether the merge has conflicts
	Is_conflicted bool `json:"is_conflicted" cborgen:"is_conflicted"`
	// message: Additional message about the merge check
	Message *string `json:"message,omitempty" cborgen:"message,omitempty"`
}

// RepoMergeCheck calls the XRPC method "sh.tangled.repo.mergeCheck".
func RepoMergeCheck(ctx context.Context, c util.LexClient, input *RepoMergeCheck_Input) (*RepoMergeCheck_Output, error) {
	var out RepoMergeCheck_Output
	if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.mergeCheck", nil, input, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
