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

package org_tangled

// schema: org.tangled.review.submitPatch

import (
	"context"

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

const (
	ReviewSubmitPatchNSID = "org.tangled.review.submitPatch"
)

// ReviewSubmitPatch_Input is the input argument to a org.tangled.review.submitPatch call.
type ReviewSubmitPatch_Input struct {
	Patch *ReviewSubmitPatch_Patch `json:"patch" cborgen:"patch"`
	// repo: DID of the repository
	Repo string `json:"repo" cborgen:"repo"`
}

// ReviewSubmitPatch_Output is the output of a org.tangled.review.submitPatch call.
type ReviewSubmitPatch_Output struct {
	// cid: CID of created org.tangled.review.patch record.
	Cid string `json:"cid" cborgen:"cid"`
	// uri: AT-URI of created org.tangled.review.patch record.
	Uri string `json:"uri" cborgen:"uri"`
}

// ReviewSubmitPatch_Patch is a "patch" in the org.tangled.review.submitPatch schema.
type ReviewSubmitPatch_Patch struct {
	Base         *GitOid `json:"base" cborgen:"base"`
	Head         *GitOid `json:"head" cborgen:"head"`
	SourceBranch *string `json:"sourceBranch,omitempty" cborgen:"sourceBranch,omitempty"`
	// sourceRepo: DID of the repository to fetch `head` from.
	SourceRepo string `json:"sourceRepo" cborgen:"sourceRepo"`
	// ticket: ticket-id
	Ticket string `json:"ticket" cborgen:"ticket"`
}

// ReviewSubmitPatch calls the XRPC method "org.tangled.review.submitPatch".
func ReviewSubmitPatch(ctx context.Context, c util.LexClient, input *ReviewSubmitPatch_Input) (*ReviewSubmitPatch_Output, error) {
	var out ReviewSubmitPatch_Output
	if err := c.LexDo(ctx, util.Procedure, "application/json", "org.tangled.review.submitPatch", nil, input, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
