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

package atproto

// schema: com.atproto.server.createAccount

import (
	"context"

	"github.com/bluesky-social/indigo/xrpc"
)

// ServerCreateAccount_Input is the input argument to a com.atproto.server.createAccount call.
type ServerCreateAccount_Input struct {
	// did: Pre-existing atproto DID, being imported to a new account.
	Did   *string `json:"did,omitempty" cborgen:"did,omitempty"`
	Email *string `json:"email,omitempty" cborgen:"email,omitempty"`
	// handle: Requested handle for the account.
	Handle     string  `json:"handle" cborgen:"handle"`
	InviteCode *string `json:"inviteCode,omitempty" cborgen:"inviteCode,omitempty"`
	// password: Initial account password. May need to meet instance-specific password strength requirements.
	Password *string `json:"password,omitempty" cborgen:"password,omitempty"`
	// plcOp: A signed DID PLC operation to be submitted as part of importing an existing account to this instance. NOTE: this optional field may be updated when full account migration is implemented.
	PlcOp *interface{} `json:"plcOp,omitempty" cborgen:"plcOp,omitempty"`
	// recoveryKey: DID PLC rotation key (aka, recovery key) to be included in PLC creation operation.
	RecoveryKey       *string `json:"recoveryKey,omitempty" cborgen:"recoveryKey,omitempty"`
	VerificationCode  *string `json:"verificationCode,omitempty" cborgen:"verificationCode,omitempty"`
	VerificationPhone *string `json:"verificationPhone,omitempty" cborgen:"verificationPhone,omitempty"`
}

// ServerCreateAccount_Output is the output of a com.atproto.server.createAccount call.
//
// Account login session returned on successful account creation.
type ServerCreateAccount_Output struct {
	AccessJwt string `json:"accessJwt" cborgen:"accessJwt"`
	// did: The DID of the new account.
	Did string `json:"did" cborgen:"did"`
	// didDoc: Complete DID document.
	DidDoc     *interface{} `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"`
	Handle     string       `json:"handle" cborgen:"handle"`
	RefreshJwt string       `json:"refreshJwt" cborgen:"refreshJwt"`
}

// ServerCreateAccount calls the XRPC method "com.atproto.server.createAccount".
func ServerCreateAccount(ctx context.Context, c *xrpc.Client, input *ServerCreateAccount_Input) (*ServerCreateAccount_Output, error) {
	var out ServerCreateAccount_Output
	if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.server.createAccount", nil, input, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
