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

package tangled

// schema: sh.tangled.git.mergeCheck

import (
	"context"

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

const (
	GitMergeCheckNSID = "sh.tangled.git.mergeCheck"
)

// GitMergeCheck_ConflictInfo is a "conflictInfo" in the sh.tangled.git.mergeCheck schema.
type GitMergeCheck_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"`
}

// GitMergeCheck_Input is the input argument to a sh.tangled.git.mergeCheck call.
type GitMergeCheck_Input struct {
	// branch: Target branch to merge into
	Branch string `json:"branch" cborgen:"branch"`
	// repo: DID of Git repository
	Repo   string                      `json:"repo" cborgen:"repo"`
	Source *GitMergeCheck_Input_Source `json:"source" cborgen:"source"`
}

type GitMergeCheck_Input_Source struct {
	// commit: Head commit ID of PR to merge
	Commit string `json:"commit" cborgen:"commit"`
	// repo: DID of source git repository
	Repo string `json:"repo" cborgen:"repo"`
}

// GitMergeCheck_Output is the output of a sh.tangled.git.mergeCheck call.
type GitMergeCheck_Output struct {
	// conflicts: List of files with merge conflicts
	Conflicts []*GitMergeCheck_ConflictInfo `json:"conflicts,omitempty" cborgen:"conflicts,omitempty"`
	// isConflicted: Whether the merge has conflicts
	IsConflicted bool `json:"isConflicted" cborgen:"isConflicted"`
	// message: Additional message about the merge check
	Message *string `json:"message,omitempty" cborgen:"message,omitempty"`
}

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

	return &out, nil
}
