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

package atproto

// schema: com.atproto.server.createSession

import (
	"context"

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

// ServerCreateSession_Input is the input argument to a com.atproto.server.createSession call.
type ServerCreateSession_Input struct {
	// allowTakendown: When true, instead of throwing error for takendown accounts, a valid response with a narrow scoped token will be returned
	AllowTakendown  *bool   `json:"allowTakendown,omitempty" cborgen:"allowTakendown,omitempty"`
	AuthFactorToken *string `json:"authFactorToken,omitempty" cborgen:"authFactorToken,omitempty"`
	// identifier: Handle or other identifier supported by the server for the authenticating user.
	Identifier string `json:"identifier" cborgen:"identifier"`
	Password   string `json:"password" cborgen:"password"`
}

// ServerCreateSession_Output is the output of a com.atproto.server.createSession call.
type ServerCreateSession_Output struct {
	AccessJwt       string       `json:"accessJwt" cborgen:"accessJwt"`
	Active          *bool        `json:"active,omitempty" cborgen:"active,omitempty"`
	Did             string       `json:"did" cborgen:"did"`
	DidDoc          *interface{} `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"`
	Email           *string      `json:"email,omitempty" cborgen:"email,omitempty"`
	EmailAuthFactor *bool        `json:"emailAuthFactor,omitempty" cborgen:"emailAuthFactor,omitempty"`
	EmailConfirmed  *bool        `json:"emailConfirmed,omitempty" cborgen:"emailConfirmed,omitempty"`
	Handle          string       `json:"handle" cborgen:"handle"`
	RefreshJwt      string       `json:"refreshJwt" cborgen:"refreshJwt"`
	// status: If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.
	Status *string `json:"status,omitempty" cborgen:"status,omitempty"`
}

// ServerCreateSession calls the XRPC method "com.atproto.server.createSession".
func ServerCreateSession(ctx context.Context, c util.LexClient, input *ServerCreateSession_Input) (*ServerCreateSession_Output, error) {
	var out ServerCreateSession_Output
	if err := c.LexDo(ctx, util.Procedure, "application/json", "com.atproto.server.createSession", nil, input, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
