// Code generated by ent, DO NOT EDIT.

package ent

import (
	"context"
	"errors"
	"fmt"
	"log"
	"reflect"

	"github.com/google/uuid"
	"github.com/in-toto/archivista/ent/migrate"

	"entgo.io/ent"
	"entgo.io/ent/dialect"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"github.com/in-toto/archivista/ent/attestation"
	"github.com/in-toto/archivista/ent/attestationcollection"
	"github.com/in-toto/archivista/ent/attestationpolicy"
	"github.com/in-toto/archivista/ent/dsse"
	"github.com/in-toto/archivista/ent/payloaddigest"
	"github.com/in-toto/archivista/ent/signature"
	"github.com/in-toto/archivista/ent/statement"
	"github.com/in-toto/archivista/ent/subject"
	"github.com/in-toto/archivista/ent/subjectdigest"
	"github.com/in-toto/archivista/ent/timestamp"
)

// Client is the client that holds all ent builders.
type Client struct {
	config
	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Attestation is the client for interacting with the Attestation builders.
	Attestation *AttestationClient
	// AttestationCollection is the client for interacting with the AttestationCollection builders.
	AttestationCollection *AttestationCollectionClient
	// AttestationPolicy is the client for interacting with the AttestationPolicy builders.
	AttestationPolicy *AttestationPolicyClient
	// Dsse is the client for interacting with the Dsse builders.
	Dsse *DsseClient
	// PayloadDigest is the client for interacting with the PayloadDigest builders.
	PayloadDigest *PayloadDigestClient
	// Signature is the client for interacting with the Signature builders.
	Signature *SignatureClient
	// Statement is the client for interacting with the Statement builders.
	Statement *StatementClient
	// Subject is the client for interacting with the Subject builders.
	Subject *SubjectClient
	// SubjectDigest is the client for interacting with the SubjectDigest builders.
	SubjectDigest *SubjectDigestClient
	// Timestamp is the client for interacting with the Timestamp builders.
	Timestamp *TimestampClient
}

// NewClient creates a new client configured with the given options.
func NewClient(opts ...Option) *Client {
	client := &Client{config: newConfig(opts...)}
	client.init()
	return client
}

func (c *Client) init() {
	c.Schema = migrate.NewSchema(c.driver)
	c.Attestation = NewAttestationClient(c.config)
	c.AttestationCollection = NewAttestationCollectionClient(c.config)
	c.AttestationPolicy = NewAttestationPolicyClient(c.config)
	c.Dsse = NewDsseClient(c.config)
	c.PayloadDigest = NewPayloadDigestClient(c.config)
	c.Signature = NewSignatureClient(c.config)
	c.Statement = NewStatementClient(c.config)
	c.Subject = NewSubjectClient(c.config)
	c.SubjectDigest = NewSubjectDigestClient(c.config)
	c.Timestamp = NewTimestampClient(c.config)
}

type (
	// config is the configuration for the client and its builder.
	config struct {
		// driver used for executing database requests.
		driver dialect.Driver
		// debug enable a debug logging.
		debug bool
		// log used for logging on debug mode.
		log func(...any)
		// hooks to execute on mutations.
		hooks *hooks
		// interceptors to execute on queries.
		inters *inters
	}
	// Option function to configure the client.
	Option func(*config)
)

// newConfig creates a new config for the client.
func newConfig(opts ...Option) config {
	cfg := config{log: log.Println, hooks: &hooks{}, inters: &inters{}}
	cfg.options(opts...)
	return cfg
}

// options applies the options on the config object.
func (c *config) options(opts ...Option) {
	for _, opt := range opts {
		opt(c)
	}
	if c.debug {
		c.driver = dialect.Debug(c.driver, c.log)
	}
}

// Debug enables debug logging on the ent.Driver.
func Debug() Option {
	return func(c *config) {
		c.debug = true
	}
}

// Log sets the logging function for debug mode.
func Log(fn func(...any)) Option {
	return func(c *config) {
		c.log = fn
	}
}

// Driver configures the client driver.
func Driver(driver dialect.Driver) Option {
	return func(c *config) {
		c.driver = driver
	}
}

// Open opens a database/sql.DB specified by the driver name and
// the data source name, and returns a new client attached to it.
// Optional parameters can be added for configuring the client.
func Open(driverName, dataSourceName string, options ...Option) (*Client, error) {
	switch driverName {
	case dialect.MySQL, dialect.Postgres, dialect.SQLite:
		drv, err := sql.Open(driverName, dataSourceName)
		if err != nil {
			return nil, err
		}
		return NewClient(append(options, Driver(drv))...), nil
	default:
		return nil, fmt.Errorf("unsupported driver: %q", driverName)
	}
}

// ErrTxStarted is returned when trying to start a new transaction from a transactional client.
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")

// Tx returns a new transactional client. The provided context
// is used until the transaction is committed or rolled back.
func (c *Client) Tx(ctx context.Context) (*Tx, error) {
	if _, ok := c.driver.(*txDriver); ok {
		return nil, ErrTxStarted
	}
	tx, err := newTx(ctx, c.driver)
	if err != nil {
		return nil, fmt.Errorf("ent: starting a transaction: %w", err)
	}
	cfg := c.config
	cfg.driver = tx
	return &Tx{
		ctx:                   ctx,
		config:                cfg,
		Attestation:           NewAttestationClient(cfg),
		AttestationCollection: NewAttestationCollectionClient(cfg),
		AttestationPolicy:     NewAttestationPolicyClient(cfg),
		Dsse:                  NewDsseClient(cfg),
		PayloadDigest:         NewPayloadDigestClient(cfg),
		Signature:             NewSignatureClient(cfg),
		Statement:             NewStatementClient(cfg),
		Subject:               NewSubjectClient(cfg),
		SubjectDigest:         NewSubjectDigestClient(cfg),
		Timestamp:             NewTimestampClient(cfg),
	}, nil
}

// BeginTx returns a transactional client with specified options.
func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {
	if _, ok := c.driver.(*txDriver); ok {
		return nil, errors.New("ent: cannot start a transaction within a transaction")
	}
	tx, err := c.driver.(interface {
		BeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)
	}).BeginTx(ctx, opts)
	if err != nil {
		return nil, fmt.Errorf("ent: starting a transaction: %w", err)
	}
	cfg := c.config
	cfg.driver = &txDriver{tx: tx, drv: c.driver}
	return &Tx{
		ctx:                   ctx,
		config:                cfg,
		Attestation:           NewAttestationClient(cfg),
		AttestationCollection: NewAttestationCollectionClient(cfg),
		AttestationPolicy:     NewAttestationPolicyClient(cfg),
		Dsse:                  NewDsseClient(cfg),
		PayloadDigest:         NewPayloadDigestClient(cfg),
		Signature:             NewSignatureClient(cfg),
		Statement:             NewStatementClient(cfg),
		Subject:               NewSubjectClient(cfg),
		SubjectDigest:         NewSubjectDigestClient(cfg),
		Timestamp:             NewTimestampClient(cfg),
	}, nil
}

// Debug returns a new debug-client. It's used to get verbose logging on specific operations.
//
//	client.Debug().
//		Attestation.
//		Query().
//		Count(ctx)
func (c *Client) Debug() *Client {
	if c.debug {
		return c
	}
	cfg := c.config
	cfg.driver = dialect.Debug(c.driver, c.log)
	client := &Client{config: cfg}
	client.init()
	return client
}

// Close closes the database connection and prevents new queries from starting.
func (c *Client) Close() error {
	return c.driver.Close()
}

// Use adds the mutation hooks to all the entity clients.
// In order to add hooks to a specific client, call: `client.Node.Use(...)`.
func (c *Client) Use(hooks ...Hook) {
	for _, n := range []interface{ Use(...Hook) }{
		c.Attestation, c.AttestationCollection, c.AttestationPolicy, c.Dsse,
		c.PayloadDigest, c.Signature, c.Statement, c.Subject, c.SubjectDigest,
		c.Timestamp,
	} {
		n.Use(hooks...)
	}
}

// Intercept adds the query interceptors to all the entity clients.
// In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
func (c *Client) Intercept(interceptors ...Interceptor) {
	for _, n := range []interface{ Intercept(...Interceptor) }{
		c.Attestation, c.AttestationCollection, c.AttestationPolicy, c.Dsse,
		c.PayloadDigest, c.Signature, c.Statement, c.Subject, c.SubjectDigest,
		c.Timestamp,
	} {
		n.Intercept(interceptors...)
	}
}

// Mutate implements the ent.Mutator interface.
func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
	switch m := m.(type) {
	case *AttestationMutation:
		return c.Attestation.mutate(ctx, m)
	case *AttestationCollectionMutation:
		return c.AttestationCollection.mutate(ctx, m)
	case *AttestationPolicyMutation:
		return c.AttestationPolicy.mutate(ctx, m)
	case *DsseMutation:
		return c.Dsse.mutate(ctx, m)
	case *PayloadDigestMutation:
		return c.PayloadDigest.mutate(ctx, m)
	case *SignatureMutation:
		return c.Signature.mutate(ctx, m)
	case *StatementMutation:
		return c.Statement.mutate(ctx, m)
	case *SubjectMutation:
		return c.Subject.mutate(ctx, m)
	case *SubjectDigestMutation:
		return c.SubjectDigest.mutate(ctx, m)
	case *TimestampMutation:
		return c.Timestamp.mutate(ctx, m)
	default:
		return nil, fmt.Errorf("ent: unknown mutation type %T", m)
	}
}

// AttestationClient is a client for the Attestation schema.
type AttestationClient struct {
	config
}

// NewAttestationClient returns a client for the Attestation from the given config.
func NewAttestationClient(c config) *AttestationClient {
	return &AttestationClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `attestation.Hooks(f(g(h())))`.
func (c *AttestationClient) Use(hooks ...Hook) {
	c.hooks.Attestation = append(c.hooks.Attestation, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `attestation.Intercept(f(g(h())))`.
func (c *AttestationClient) Intercept(interceptors ...Interceptor) {
	c.inters.Attestation = append(c.inters.Attestation, interceptors...)
}

// Create returns a builder for creating a Attestation entity.
func (c *AttestationClient) Create() *AttestationCreate {
	mutation := newAttestationMutation(c.config, OpCreate)
	return &AttestationCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of Attestation entities.
func (c *AttestationClient) CreateBulk(builders ...*AttestationCreate) *AttestationCreateBulk {
	return &AttestationCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *AttestationClient) MapCreateBulk(slice any, setFunc func(*AttestationCreate, int)) *AttestationCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &AttestationCreateBulk{err: fmt.Errorf("calling to AttestationClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*AttestationCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &AttestationCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for Attestation.
func (c *AttestationClient) Update() *AttestationUpdate {
	mutation := newAttestationMutation(c.config, OpUpdate)
	return &AttestationUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *AttestationClient) UpdateOne(_m *Attestation) *AttestationUpdateOne {
	mutation := newAttestationMutation(c.config, OpUpdateOne, withAttestation(_m))
	return &AttestationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *AttestationClient) UpdateOneID(id uuid.UUID) *AttestationUpdateOne {
	mutation := newAttestationMutation(c.config, OpUpdateOne, withAttestationID(id))
	return &AttestationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for Attestation.
func (c *AttestationClient) Delete() *AttestationDelete {
	mutation := newAttestationMutation(c.config, OpDelete)
	return &AttestationDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *AttestationClient) DeleteOne(_m *Attestation) *AttestationDeleteOne {
	return c.DeleteOneID(_m.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *AttestationClient) DeleteOneID(id uuid.UUID) *AttestationDeleteOne {
	builder := c.Delete().Where(attestation.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &AttestationDeleteOne{builder}
}

// Query returns a query builder for Attestation.
func (c *AttestationClient) Query() *AttestationQuery {
	return &AttestationQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeAttestation},
		inters: c.Interceptors(),
	}
}

// Get returns a Attestation entity by its id.
func (c *AttestationClient) Get(ctx context.Context, id uuid.UUID) (*Attestation, error) {
	return c.Query().Where(attestation.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *AttestationClient) GetX(ctx context.Context, id uuid.UUID) *Attestation {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryAttestationCollection queries the attestation_collection edge of a Attestation.
func (c *AttestationClient) QueryAttestationCollection(_m *Attestation) *AttestationCollectionQuery {
	query := (&AttestationCollectionClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(attestation.Table, attestation.FieldID, id),
			sqlgraph.To(attestationcollection.Table, attestationcollection.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, attestation.AttestationCollectionTable, attestation.AttestationCollectionColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *AttestationClient) Hooks() []Hook {
	return c.hooks.Attestation
}

// Interceptors returns the client interceptors.
func (c *AttestationClient) Interceptors() []Interceptor {
	return c.inters.Attestation
}

func (c *AttestationClient) mutate(ctx context.Context, m *AttestationMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&AttestationCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&AttestationUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&AttestationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&AttestationDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown Attestation mutation op: %q", m.Op())
	}
}

// AttestationCollectionClient is a client for the AttestationCollection schema.
type AttestationCollectionClient struct {
	config
}

// NewAttestationCollectionClient returns a client for the AttestationCollection from the given config.
func NewAttestationCollectionClient(c config) *AttestationCollectionClient {
	return &AttestationCollectionClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `attestationcollection.Hooks(f(g(h())))`.
func (c *AttestationCollectionClient) Use(hooks ...Hook) {
	c.hooks.AttestationCollection = append(c.hooks.AttestationCollection, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `attestationcollection.Intercept(f(g(h())))`.
func (c *AttestationCollectionClient) Intercept(interceptors ...Interceptor) {
	c.inters.AttestationCollection = append(c.inters.AttestationCollection, interceptors...)
}

// Create returns a builder for creating a AttestationCollection entity.
func (c *AttestationCollectionClient) Create() *AttestationCollectionCreate {
	mutation := newAttestationCollectionMutation(c.config, OpCreate)
	return &AttestationCollectionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of AttestationCollection entities.
func (c *AttestationCollectionClient) CreateBulk(builders ...*AttestationCollectionCreate) *AttestationCollectionCreateBulk {
	return &AttestationCollectionCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *AttestationCollectionClient) MapCreateBulk(slice any, setFunc func(*AttestationCollectionCreate, int)) *AttestationCollectionCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &AttestationCollectionCreateBulk{err: fmt.Errorf("calling to AttestationCollectionClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*AttestationCollectionCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &AttestationCollectionCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for AttestationCollection.
func (c *AttestationCollectionClient) Update() *AttestationCollectionUpdate {
	mutation := newAttestationCollectionMutation(c.config, OpUpdate)
	return &AttestationCollectionUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *AttestationCollectionClient) UpdateOne(_m *AttestationCollection) *AttestationCollectionUpdateOne {
	mutation := newAttestationCollectionMutation(c.config, OpUpdateOne, withAttestationCollection(_m))
	return &AttestationCollectionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *AttestationCollectionClient) UpdateOneID(id uuid.UUID) *AttestationCollectionUpdateOne {
	mutation := newAttestationCollectionMutation(c.config, OpUpdateOne, withAttestationCollectionID(id))
	return &AttestationCollectionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for AttestationCollection.
func (c *AttestationCollectionClient) Delete() *AttestationCollectionDelete {
	mutation := newAttestationCollectionMutation(c.config, OpDelete)
	return &AttestationCollectionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *AttestationCollectionClient) DeleteOne(_m *AttestationCollection) *AttestationCollectionDeleteOne {
	return c.DeleteOneID(_m.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *AttestationCollectionClient) DeleteOneID(id uuid.UUID) *AttestationCollectionDeleteOne {
	builder := c.Delete().Where(attestationcollection.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &AttestationCollectionDeleteOne{builder}
}

// Query returns a query builder for AttestationCollection.
func (c *AttestationCollectionClient) Query() *AttestationCollectionQuery {
	return &AttestationCollectionQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeAttestationCollection},
		inters: c.Interceptors(),
	}
}

// Get returns a AttestationCollection entity by its id.
func (c *AttestationCollectionClient) Get(ctx context.Context, id uuid.UUID) (*AttestationCollection, error) {
	return c.Query().Where(attestationcollection.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *AttestationCollectionClient) GetX(ctx context.Context, id uuid.UUID) *AttestationCollection {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryAttestations queries the attestations edge of a AttestationCollection.
func (c *AttestationCollectionClient) QueryAttestations(_m *AttestationCollection) *AttestationQuery {
	query := (&AttestationClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(attestationcollection.Table, attestationcollection.FieldID, id),
			sqlgraph.To(attestation.Table, attestation.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, attestationcollection.AttestationsTable, attestationcollection.AttestationsColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryStatement queries the statement edge of a AttestationCollection.
func (c *AttestationCollectionClient) QueryStatement(_m *AttestationCollection) *StatementQuery {
	query := (&StatementClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(attestationcollection.Table, attestationcollection.FieldID, id),
			sqlgraph.To(statement.Table, statement.FieldID),
			sqlgraph.Edge(sqlgraph.O2O, true, attestationcollection.StatementTable, attestationcollection.StatementColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *AttestationCollectionClient) Hooks() []Hook {
	return c.hooks.AttestationCollection
}

// Interceptors returns the client interceptors.
func (c *AttestationCollectionClient) Interceptors() []Interceptor {
	return c.inters.AttestationCollection
}

func (c *AttestationCollectionClient) mutate(ctx context.Context, m *AttestationCollectionMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&AttestationCollectionCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&AttestationCollectionUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&AttestationCollectionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&AttestationCollectionDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown AttestationCollection mutation op: %q", m.Op())
	}
}

// AttestationPolicyClient is a client for the AttestationPolicy schema.
type AttestationPolicyClient struct {
	config
}

// NewAttestationPolicyClient returns a client for the AttestationPolicy from the given config.
func NewAttestationPolicyClient(c config) *AttestationPolicyClient {
	return &AttestationPolicyClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `attestationpolicy.Hooks(f(g(h())))`.
func (c *AttestationPolicyClient) Use(hooks ...Hook) {
	c.hooks.AttestationPolicy = append(c.hooks.AttestationPolicy, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `attestationpolicy.Intercept(f(g(h())))`.
func (c *AttestationPolicyClient) Intercept(interceptors ...Interceptor) {
	c.inters.AttestationPolicy = append(c.inters.AttestationPolicy, interceptors...)
}

// Create returns a builder for creating a AttestationPolicy entity.
func (c *AttestationPolicyClient) Create() *AttestationPolicyCreate {
	mutation := newAttestationPolicyMutation(c.config, OpCreate)
	return &AttestationPolicyCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of AttestationPolicy entities.
func (c *AttestationPolicyClient) CreateBulk(builders ...*AttestationPolicyCreate) *AttestationPolicyCreateBulk {
	return &AttestationPolicyCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *AttestationPolicyClient) MapCreateBulk(slice any, setFunc func(*AttestationPolicyCreate, int)) *AttestationPolicyCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &AttestationPolicyCreateBulk{err: fmt.Errorf("calling to AttestationPolicyClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*AttestationPolicyCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &AttestationPolicyCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for AttestationPolicy.
func (c *AttestationPolicyClient) Update() *AttestationPolicyUpdate {
	mutation := newAttestationPolicyMutation(c.config, OpUpdate)
	return &AttestationPolicyUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *AttestationPolicyClient) UpdateOne(_m *AttestationPolicy) *AttestationPolicyUpdateOne {
	mutation := newAttestationPolicyMutation(c.config, OpUpdateOne, withAttestationPolicy(_m))
	return &AttestationPolicyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *AttestationPolicyClient) UpdateOneID(id uuid.UUID) *AttestationPolicyUpdateOne {
	mutation := newAttestationPolicyMutation(c.config, OpUpdateOne, withAttestationPolicyID(id))
	return &AttestationPolicyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for AttestationPolicy.
func (c *AttestationPolicyClient) Delete() *AttestationPolicyDelete {
	mutation := newAttestationPolicyMutation(c.config, OpDelete)
	return &AttestationPolicyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *AttestationPolicyClient) DeleteOne(_m *AttestationPolicy) *AttestationPolicyDeleteOne {
	return c.DeleteOneID(_m.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *AttestationPolicyClient) DeleteOneID(id uuid.UUID) *AttestationPolicyDeleteOne {
	builder := c.Delete().Where(attestationpolicy.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &AttestationPolicyDeleteOne{builder}
}

// Query returns a query builder for AttestationPolicy.
func (c *AttestationPolicyClient) Query() *AttestationPolicyQuery {
	return &AttestationPolicyQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeAttestationPolicy},
		inters: c.Interceptors(),
	}
}

// Get returns a AttestationPolicy entity by its id.
func (c *AttestationPolicyClient) Get(ctx context.Context, id uuid.UUID) (*AttestationPolicy, error) {
	return c.Query().Where(attestationpolicy.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *AttestationPolicyClient) GetX(ctx context.Context, id uuid.UUID) *AttestationPolicy {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryStatement queries the statement edge of a AttestationPolicy.
func (c *AttestationPolicyClient) QueryStatement(_m *AttestationPolicy) *StatementQuery {
	query := (&StatementClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(attestationpolicy.Table, attestationpolicy.FieldID, id),
			sqlgraph.To(statement.Table, statement.FieldID),
			sqlgraph.Edge(sqlgraph.O2O, true, attestationpolicy.StatementTable, attestationpolicy.StatementColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *AttestationPolicyClient) Hooks() []Hook {
	return c.hooks.AttestationPolicy
}

// Interceptors returns the client interceptors.
func (c *AttestationPolicyClient) Interceptors() []Interceptor {
	return c.inters.AttestationPolicy
}

func (c *AttestationPolicyClient) mutate(ctx context.Context, m *AttestationPolicyMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&AttestationPolicyCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&AttestationPolicyUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&AttestationPolicyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&AttestationPolicyDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown AttestationPolicy mutation op: %q", m.Op())
	}
}

// DsseClient is a client for the Dsse schema.
type DsseClient struct {
	config
}

// NewDsseClient returns a client for the Dsse from the given config.
func NewDsseClient(c config) *DsseClient {
	return &DsseClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `dsse.Hooks(f(g(h())))`.
func (c *DsseClient) Use(hooks ...Hook) {
	c.hooks.Dsse = append(c.hooks.Dsse, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `dsse.Intercept(f(g(h())))`.
func (c *DsseClient) Intercept(interceptors ...Interceptor) {
	c.inters.Dsse = append(c.inters.Dsse, interceptors...)
}

// Create returns a builder for creating a Dsse entity.
func (c *DsseClient) Create() *DsseCreate {
	mutation := newDsseMutation(c.config, OpCreate)
	return &DsseCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of Dsse entities.
func (c *DsseClient) CreateBulk(builders ...*DsseCreate) *DsseCreateBulk {
	return &DsseCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *DsseClient) MapCreateBulk(slice any, setFunc func(*DsseCreate, int)) *DsseCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &DsseCreateBulk{err: fmt.Errorf("calling to DsseClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*DsseCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &DsseCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for Dsse.
func (c *DsseClient) Update() *DsseUpdate {
	mutation := newDsseMutation(c.config, OpUpdate)
	return &DsseUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *DsseClient) UpdateOne(_m *Dsse) *DsseUpdateOne {
	mutation := newDsseMutation(c.config, OpUpdateOne, withDsse(_m))
	return &DsseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *DsseClient) UpdateOneID(id uuid.UUID) *DsseUpdateOne {
	mutation := newDsseMutation(c.config, OpUpdateOne, withDsseID(id))
	return &DsseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for Dsse.
func (c *DsseClient) Delete() *DsseDelete {
	mutation := newDsseMutation(c.config, OpDelete)
	return &DsseDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *DsseClient) DeleteOne(_m *Dsse) *DsseDeleteOne {
	return c.DeleteOneID(_m.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *DsseClient) DeleteOneID(id uuid.UUID) *DsseDeleteOne {
	builder := c.Delete().Where(dsse.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &DsseDeleteOne{builder}
}

// Query returns a query builder for Dsse.
func (c *DsseClient) Query() *DsseQuery {
	return &DsseQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeDsse},
		inters: c.Interceptors(),
	}
}

// Get returns a Dsse entity by its id.
func (c *DsseClient) Get(ctx context.Context, id uuid.UUID) (*Dsse, error) {
	return c.Query().Where(dsse.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *DsseClient) GetX(ctx context.Context, id uuid.UUID) *Dsse {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryStatement queries the statement edge of a Dsse.
func (c *DsseClient) QueryStatement(_m *Dsse) *StatementQuery {
	query := (&StatementClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(dsse.Table, dsse.FieldID, id),
			sqlgraph.To(statement.Table, statement.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, dsse.StatementTable, dsse.StatementColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QuerySignatures queries the signatures edge of a Dsse.
func (c *DsseClient) QuerySignatures(_m *Dsse) *SignatureQuery {
	query := (&SignatureClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(dsse.Table, dsse.FieldID, id),
			sqlgraph.To(signature.Table, signature.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, dsse.SignaturesTable, dsse.SignaturesColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryPayloadDigests queries the payload_digests edge of a Dsse.
func (c *DsseClient) QueryPayloadDigests(_m *Dsse) *PayloadDigestQuery {
	query := (&PayloadDigestClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(dsse.Table, dsse.FieldID, id),
			sqlgraph.To(payloaddigest.Table, payloaddigest.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, dsse.PayloadDigestsTable, dsse.PayloadDigestsColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *DsseClient) Hooks() []Hook {
	return c.hooks.Dsse
}

// Interceptors returns the client interceptors.
func (c *DsseClient) Interceptors() []Interceptor {
	return c.inters.Dsse
}

func (c *DsseClient) mutate(ctx context.Context, m *DsseMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&DsseCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&DsseUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&DsseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&DsseDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown Dsse mutation op: %q", m.Op())
	}
}

// PayloadDigestClient is a client for the PayloadDigest schema.
type PayloadDigestClient struct {
	config
}

// NewPayloadDigestClient returns a client for the PayloadDigest from the given config.
func NewPayloadDigestClient(c config) *PayloadDigestClient {
	return &PayloadDigestClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `payloaddigest.Hooks(f(g(h())))`.
func (c *PayloadDigestClient) Use(hooks ...Hook) {
	c.hooks.PayloadDigest = append(c.hooks.PayloadDigest, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `payloaddigest.Intercept(f(g(h())))`.
func (c *PayloadDigestClient) Intercept(interceptors ...Interceptor) {
	c.inters.PayloadDigest = append(c.inters.PayloadDigest, interceptors...)
}

// Create returns a builder for creating a PayloadDigest entity.
func (c *PayloadDigestClient) Create() *PayloadDigestCreate {
	mutation := newPayloadDigestMutation(c.config, OpCreate)
	return &PayloadDigestCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of PayloadDigest entities.
func (c *PayloadDigestClient) CreateBulk(builders ...*PayloadDigestCreate) *PayloadDigestCreateBulk {
	return &PayloadDigestCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *PayloadDigestClient) MapCreateBulk(slice any, setFunc func(*PayloadDigestCreate, int)) *PayloadDigestCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &PayloadDigestCreateBulk{err: fmt.Errorf("calling to PayloadDigestClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*PayloadDigestCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &PayloadDigestCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for PayloadDigest.
func (c *PayloadDigestClient) Update() *PayloadDigestUpdate {
	mutation := newPayloadDigestMutation(c.config, OpUpdate)
	return &PayloadDigestUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *PayloadDigestClient) UpdateOne(_m *PayloadDigest) *PayloadDigestUpdateOne {
	mutation := newPayloadDigestMutation(c.config, OpUpdateOne, withPayloadDigest(_m))
	return &PayloadDigestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *PayloadDigestClient) UpdateOneID(id uuid.UUID) *PayloadDigestUpdateOne {
	mutation := newPayloadDigestMutation(c.config, OpUpdateOne, withPayloadDigestID(id))
	return &PayloadDigestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for PayloadDigest.
func (c *PayloadDigestClient) Delete() *PayloadDigestDelete {
	mutation := newPayloadDigestMutation(c.config, OpDelete)
	return &PayloadDigestDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *PayloadDigestClient) DeleteOne(_m *PayloadDigest) *PayloadDigestDeleteOne {
	return c.DeleteOneID(_m.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *PayloadDigestClient) DeleteOneID(id uuid.UUID) *PayloadDigestDeleteOne {
	builder := c.Delete().Where(payloaddigest.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &PayloadDigestDeleteOne{builder}
}

// Query returns a query builder for PayloadDigest.
func (c *PayloadDigestClient) Query() *PayloadDigestQuery {
	return &PayloadDigestQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypePayloadDigest},
		inters: c.Interceptors(),
	}
}

// Get returns a PayloadDigest entity by its id.
func (c *PayloadDigestClient) Get(ctx context.Context, id uuid.UUID) (*PayloadDigest, error) {
	return c.Query().Where(payloaddigest.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *PayloadDigestClient) GetX(ctx context.Context, id uuid.UUID) *PayloadDigest {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryDsse queries the dsse edge of a PayloadDigest.
func (c *PayloadDigestClient) QueryDsse(_m *PayloadDigest) *DsseQuery {
	query := (&DsseClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(payloaddigest.Table, payloaddigest.FieldID, id),
			sqlgraph.To(dsse.Table, dsse.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, payloaddigest.DsseTable, payloaddigest.DsseColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *PayloadDigestClient) Hooks() []Hook {
	return c.hooks.PayloadDigest
}

// Interceptors returns the client interceptors.
func (c *PayloadDigestClient) Interceptors() []Interceptor {
	return c.inters.PayloadDigest
}

func (c *PayloadDigestClient) mutate(ctx context.Context, m *PayloadDigestMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&PayloadDigestCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&PayloadDigestUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&PayloadDigestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&PayloadDigestDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown PayloadDigest mutation op: %q", m.Op())
	}
}

// SignatureClient is a client for the Signature schema.
type SignatureClient struct {
	config
}

// NewSignatureClient returns a client for the Signature from the given config.
func NewSignatureClient(c config) *SignatureClient {
	return &SignatureClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `signature.Hooks(f(g(h())))`.
func (c *SignatureClient) Use(hooks ...Hook) {
	c.hooks.Signature = append(c.hooks.Signature, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `signature.Intercept(f(g(h())))`.
func (c *SignatureClient) Intercept(interceptors ...Interceptor) {
	c.inters.Signature = append(c.inters.Signature, interceptors...)
}

// Create returns a builder for creating a Signature entity.
func (c *SignatureClient) Create() *SignatureCreate {
	mutation := newSignatureMutation(c.config, OpCreate)
	return &SignatureCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of Signature entities.
func (c *SignatureClient) CreateBulk(builders ...*SignatureCreate) *SignatureCreateBulk {
	return &SignatureCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *SignatureClient) MapCreateBulk(slice any, setFunc func(*SignatureCreate, int)) *SignatureCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &SignatureCreateBulk{err: fmt.Errorf("calling to SignatureClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*SignatureCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &SignatureCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for Signature.
func (c *SignatureClient) Update() *SignatureUpdate {
	mutation := newSignatureMutation(c.config, OpUpdate)
	return &SignatureUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *SignatureClient) UpdateOne(_m *Signature) *SignatureUpdateOne {
	mutation := newSignatureMutation(c.config, OpUpdateOne, withSignature(_m))
	return &SignatureUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *SignatureClient) UpdateOneID(id uuid.UUID) *SignatureUpdateOne {
	mutation := newSignatureMutation(c.config, OpUpdateOne, withSignatureID(id))
	return &SignatureUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for Signature.
func (c *SignatureClient) Delete() *SignatureDelete {
	mutation := newSignatureMutation(c.config, OpDelete)
	return &SignatureDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *SignatureClient) DeleteOne(_m *Signature) *SignatureDeleteOne {
	return c.DeleteOneID(_m.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *SignatureClient) DeleteOneID(id uuid.UUID) *SignatureDeleteOne {
	builder := c.Delete().Where(signature.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &SignatureDeleteOne{builder}
}

// Query returns a query builder for Signature.
func (c *SignatureClient) Query() *SignatureQuery {
	return &SignatureQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeSignature},
		inters: c.Interceptors(),
	}
}

// Get returns a Signature entity by its id.
func (c *SignatureClient) Get(ctx context.Context, id uuid.UUID) (*Signature, error) {
	return c.Query().Where(signature.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *SignatureClient) GetX(ctx context.Context, id uuid.UUID) *Signature {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryDsse queries the dsse edge of a Signature.
func (c *SignatureClient) QueryDsse(_m *Signature) *DsseQuery {
	query := (&DsseClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(signature.Table, signature.FieldID, id),
			sqlgraph.To(dsse.Table, dsse.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, signature.DsseTable, signature.DsseColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryTimestamps queries the timestamps edge of a Signature.
func (c *SignatureClient) QueryTimestamps(_m *Signature) *TimestampQuery {
	query := (&TimestampClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(signature.Table, signature.FieldID, id),
			sqlgraph.To(timestamp.Table, timestamp.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, signature.TimestampsTable, signature.TimestampsColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *SignatureClient) Hooks() []Hook {
	return c.hooks.Signature
}

// Interceptors returns the client interceptors.
func (c *SignatureClient) Interceptors() []Interceptor {
	return c.inters.Signature
}

func (c *SignatureClient) mutate(ctx context.Context, m *SignatureMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&SignatureCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&SignatureUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&SignatureUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&SignatureDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown Signature mutation op: %q", m.Op())
	}
}

// StatementClient is a client for the Statement schema.
type StatementClient struct {
	config
}

// NewStatementClient returns a client for the Statement from the given config.
func NewStatementClient(c config) *StatementClient {
	return &StatementClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `statement.Hooks(f(g(h())))`.
func (c *StatementClient) Use(hooks ...Hook) {
	c.hooks.Statement = append(c.hooks.Statement, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `statement.Intercept(f(g(h())))`.
func (c *StatementClient) Intercept(interceptors ...Interceptor) {
	c.inters.Statement = append(c.inters.Statement, interceptors...)
}

// Create returns a builder for creating a Statement entity.
func (c *StatementClient) Create() *StatementCreate {
	mutation := newStatementMutation(c.config, OpCreate)
	return &StatementCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of Statement entities.
func (c *StatementClient) CreateBulk(builders ...*StatementCreate) *StatementCreateBulk {
	return &StatementCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *StatementClient) MapCreateBulk(slice any, setFunc func(*StatementCreate, int)) *StatementCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &StatementCreateBulk{err: fmt.Errorf("calling to StatementClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*StatementCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &StatementCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for Statement.
func (c *StatementClient) Update() *StatementUpdate {
	mutation := newStatementMutation(c.config, OpUpdate)
	return &StatementUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *StatementClient) UpdateOne(_m *Statement) *StatementUpdateOne {
	mutation := newStatementMutation(c.config, OpUpdateOne, withStatement(_m))
	return &StatementUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *StatementClient) UpdateOneID(id uuid.UUID) *StatementUpdateOne {
	mutation := newStatementMutation(c.config, OpUpdateOne, withStatementID(id))
	return &StatementUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for Statement.
func (c *StatementClient) Delete() *StatementDelete {
	mutation := newStatementMutation(c.config, OpDelete)
	return &StatementDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *StatementClient) DeleteOne(_m *Statement) *StatementDeleteOne {
	return c.DeleteOneID(_m.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *StatementClient) DeleteOneID(id uuid.UUID) *StatementDeleteOne {
	builder := c.Delete().Where(statement.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &StatementDeleteOne{builder}
}

// Query returns a query builder for Statement.
func (c *StatementClient) Query() *StatementQuery {
	return &StatementQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeStatement},
		inters: c.Interceptors(),
	}
}

// Get returns a Statement entity by its id.
func (c *StatementClient) Get(ctx context.Context, id uuid.UUID) (*Statement, error) {
	return c.Query().Where(statement.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *StatementClient) GetX(ctx context.Context, id uuid.UUID) *Statement {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QuerySubjects queries the subjects edge of a Statement.
func (c *StatementClient) QuerySubjects(_m *Statement) *SubjectQuery {
	query := (&SubjectClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(statement.Table, statement.FieldID, id),
			sqlgraph.To(subject.Table, subject.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, statement.SubjectsTable, statement.SubjectsColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryPolicy queries the policy edge of a Statement.
func (c *StatementClient) QueryPolicy(_m *Statement) *AttestationPolicyQuery {
	query := (&AttestationPolicyClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(statement.Table, statement.FieldID, id),
			sqlgraph.To(attestationpolicy.Table, attestationpolicy.FieldID),
			sqlgraph.Edge(sqlgraph.O2O, false, statement.PolicyTable, statement.PolicyColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryAttestationCollections queries the attestation_collections edge of a Statement.
func (c *StatementClient) QueryAttestationCollections(_m *Statement) *AttestationCollectionQuery {
	query := (&AttestationCollectionClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(statement.Table, statement.FieldID, id),
			sqlgraph.To(attestationcollection.Table, attestationcollection.FieldID),
			sqlgraph.Edge(sqlgraph.O2O, false, statement.AttestationCollectionsTable, statement.AttestationCollectionsColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryDsse queries the dsse edge of a Statement.
func (c *StatementClient) QueryDsse(_m *Statement) *DsseQuery {
	query := (&DsseClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(statement.Table, statement.FieldID, id),
			sqlgraph.To(dsse.Table, dsse.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, true, statement.DsseTable, statement.DsseColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *StatementClient) Hooks() []Hook {
	return c.hooks.Statement
}

// Interceptors returns the client interceptors.
func (c *StatementClient) Interceptors() []Interceptor {
	return c.inters.Statement
}

func (c *StatementClient) mutate(ctx context.Context, m *StatementMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&StatementCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&StatementUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&StatementUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&StatementDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown Statement mutation op: %q", m.Op())
	}
}

// SubjectClient is a client for the Subject schema.
type SubjectClient struct {
	config
}

// NewSubjectClient returns a client for the Subject from the given config.
func NewSubjectClient(c config) *SubjectClient {
	return &SubjectClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `subject.Hooks(f(g(h())))`.
func (c *SubjectClient) Use(hooks ...Hook) {
	c.hooks.Subject = append(c.hooks.Subject, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `subject.Intercept(f(g(h())))`.
func (c *SubjectClient) Intercept(interceptors ...Interceptor) {
	c.inters.Subject = append(c.inters.Subject, interceptors...)
}

// Create returns a builder for creating a Subject entity.
func (c *SubjectClient) Create() *SubjectCreate {
	mutation := newSubjectMutation(c.config, OpCreate)
	return &SubjectCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of Subject entities.
func (c *SubjectClient) CreateBulk(builders ...*SubjectCreate) *SubjectCreateBulk {
	return &SubjectCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *SubjectClient) MapCreateBulk(slice any, setFunc func(*SubjectCreate, int)) *SubjectCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &SubjectCreateBulk{err: fmt.Errorf("calling to SubjectClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*SubjectCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &SubjectCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for Subject.
func (c *SubjectClient) Update() *SubjectUpdate {
	mutation := newSubjectMutation(c.config, OpUpdate)
	return &SubjectUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *SubjectClient) UpdateOne(_m *Subject) *SubjectUpdateOne {
	mutation := newSubjectMutation(c.config, OpUpdateOne, withSubject(_m))
	return &SubjectUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *SubjectClient) UpdateOneID(id uuid.UUID) *SubjectUpdateOne {
	mutation := newSubjectMutation(c.config, OpUpdateOne, withSubjectID(id))
	return &SubjectUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for Subject.
func (c *SubjectClient) Delete() *SubjectDelete {
	mutation := newSubjectMutation(c.config, OpDelete)
	return &SubjectDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *SubjectClient) DeleteOne(_m *Subject) *SubjectDeleteOne {
	return c.DeleteOneID(_m.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *SubjectClient) DeleteOneID(id uuid.UUID) *SubjectDeleteOne {
	builder := c.Delete().Where(subject.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &SubjectDeleteOne{builder}
}

// Query returns a query builder for Subject.
func (c *SubjectClient) Query() *SubjectQuery {
	return &SubjectQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeSubject},
		inters: c.Interceptors(),
	}
}

// Get returns a Subject entity by its id.
func (c *SubjectClient) Get(ctx context.Context, id uuid.UUID) (*Subject, error) {
	return c.Query().Where(subject.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *SubjectClient) GetX(ctx context.Context, id uuid.UUID) *Subject {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QuerySubjectDigests queries the subject_digests edge of a Subject.
func (c *SubjectClient) QuerySubjectDigests(_m *Subject) *SubjectDigestQuery {
	query := (&SubjectDigestClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(subject.Table, subject.FieldID, id),
			sqlgraph.To(subjectdigest.Table, subjectdigest.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, subject.SubjectDigestsTable, subject.SubjectDigestsColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryStatement queries the statement edge of a Subject.
func (c *SubjectClient) QueryStatement(_m *Subject) *StatementQuery {
	query := (&StatementClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(subject.Table, subject.FieldID, id),
			sqlgraph.To(statement.Table, statement.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, subject.StatementTable, subject.StatementColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *SubjectClient) Hooks() []Hook {
	return c.hooks.Subject
}

// Interceptors returns the client interceptors.
func (c *SubjectClient) Interceptors() []Interceptor {
	return c.inters.Subject
}

func (c *SubjectClient) mutate(ctx context.Context, m *SubjectMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&SubjectCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&SubjectUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&SubjectUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&SubjectDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown Subject mutation op: %q", m.Op())
	}
}

// SubjectDigestClient is a client for the SubjectDigest schema.
type SubjectDigestClient struct {
	config
}

// NewSubjectDigestClient returns a client for the SubjectDigest from the given config.
func NewSubjectDigestClient(c config) *SubjectDigestClient {
	return &SubjectDigestClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `subjectdigest.Hooks(f(g(h())))`.
func (c *SubjectDigestClient) Use(hooks ...Hook) {
	c.hooks.SubjectDigest = append(c.hooks.SubjectDigest, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `subjectdigest.Intercept(f(g(h())))`.
func (c *SubjectDigestClient) Intercept(interceptors ...Interceptor) {
	c.inters.SubjectDigest = append(c.inters.SubjectDigest, interceptors...)
}

// Create returns a builder for creating a SubjectDigest entity.
func (c *SubjectDigestClient) Create() *SubjectDigestCreate {
	mutation := newSubjectDigestMutation(c.config, OpCreate)
	return &SubjectDigestCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of SubjectDigest entities.
func (c *SubjectDigestClient) CreateBulk(builders ...*SubjectDigestCreate) *SubjectDigestCreateBulk {
	return &SubjectDigestCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *SubjectDigestClient) MapCreateBulk(slice any, setFunc func(*SubjectDigestCreate, int)) *SubjectDigestCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &SubjectDigestCreateBulk{err: fmt.Errorf("calling to SubjectDigestClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*SubjectDigestCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &SubjectDigestCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for SubjectDigest.
func (c *SubjectDigestClient) Update() *SubjectDigestUpdate {
	mutation := newSubjectDigestMutation(c.config, OpUpdate)
	return &SubjectDigestUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *SubjectDigestClient) UpdateOne(_m *SubjectDigest) *SubjectDigestUpdateOne {
	mutation := newSubjectDigestMutation(c.config, OpUpdateOne, withSubjectDigest(_m))
	return &SubjectDigestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *SubjectDigestClient) UpdateOneID(id uuid.UUID) *SubjectDigestUpdateOne {
	mutation := newSubjectDigestMutation(c.config, OpUpdateOne, withSubjectDigestID(id))
	return &SubjectDigestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for SubjectDigest.
func (c *SubjectDigestClient) Delete() *SubjectDigestDelete {
	mutation := newSubjectDigestMutation(c.config, OpDelete)
	return &SubjectDigestDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *SubjectDigestClient) DeleteOne(_m *SubjectDigest) *SubjectDigestDeleteOne {
	return c.DeleteOneID(_m.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *SubjectDigestClient) DeleteOneID(id uuid.UUID) *SubjectDigestDeleteOne {
	builder := c.Delete().Where(subjectdigest.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &SubjectDigestDeleteOne{builder}
}

// Query returns a query builder for SubjectDigest.
func (c *SubjectDigestClient) Query() *SubjectDigestQuery {
	return &SubjectDigestQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeSubjectDigest},
		inters: c.Interceptors(),
	}
}

// Get returns a SubjectDigest entity by its id.
func (c *SubjectDigestClient) Get(ctx context.Context, id uuid.UUID) (*SubjectDigest, error) {
	return c.Query().Where(subjectdigest.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *SubjectDigestClient) GetX(ctx context.Context, id uuid.UUID) *SubjectDigest {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QuerySubject queries the subject edge of a SubjectDigest.
func (c *SubjectDigestClient) QuerySubject(_m *SubjectDigest) *SubjectQuery {
	query := (&SubjectClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(subjectdigest.Table, subjectdigest.FieldID, id),
			sqlgraph.To(subject.Table, subject.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, subjectdigest.SubjectTable, subjectdigest.SubjectColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *SubjectDigestClient) Hooks() []Hook {
	return c.hooks.SubjectDigest
}

// Interceptors returns the client interceptors.
func (c *SubjectDigestClient) Interceptors() []Interceptor {
	return c.inters.SubjectDigest
}

func (c *SubjectDigestClient) mutate(ctx context.Context, m *SubjectDigestMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&SubjectDigestCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&SubjectDigestUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&SubjectDigestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&SubjectDigestDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown SubjectDigest mutation op: %q", m.Op())
	}
}

// TimestampClient is a client for the Timestamp schema.
type TimestampClient struct {
	config
}

// NewTimestampClient returns a client for the Timestamp from the given config.
func NewTimestampClient(c config) *TimestampClient {
	return &TimestampClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `timestamp.Hooks(f(g(h())))`.
func (c *TimestampClient) Use(hooks ...Hook) {
	c.hooks.Timestamp = append(c.hooks.Timestamp, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `timestamp.Intercept(f(g(h())))`.
func (c *TimestampClient) Intercept(interceptors ...Interceptor) {
	c.inters.Timestamp = append(c.inters.Timestamp, interceptors...)
}

// Create returns a builder for creating a Timestamp entity.
func (c *TimestampClient) Create() *TimestampCreate {
	mutation := newTimestampMutation(c.config, OpCreate)
	return &TimestampCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of Timestamp entities.
func (c *TimestampClient) CreateBulk(builders ...*TimestampCreate) *TimestampCreateBulk {
	return &TimestampCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *TimestampClient) MapCreateBulk(slice any, setFunc func(*TimestampCreate, int)) *TimestampCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &TimestampCreateBulk{err: fmt.Errorf("calling to TimestampClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*TimestampCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &TimestampCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for Timestamp.
func (c *TimestampClient) Update() *TimestampUpdate {
	mutation := newTimestampMutation(c.config, OpUpdate)
	return &TimestampUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *TimestampClient) UpdateOne(_m *Timestamp) *TimestampUpdateOne {
	mutation := newTimestampMutation(c.config, OpUpdateOne, withTimestamp(_m))
	return &TimestampUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *TimestampClient) UpdateOneID(id uuid.UUID) *TimestampUpdateOne {
	mutation := newTimestampMutation(c.config, OpUpdateOne, withTimestampID(id))
	return &TimestampUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for Timestamp.
func (c *TimestampClient) Delete() *TimestampDelete {
	mutation := newTimestampMutation(c.config, OpDelete)
	return &TimestampDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *TimestampClient) DeleteOne(_m *Timestamp) *TimestampDeleteOne {
	return c.DeleteOneID(_m.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *TimestampClient) DeleteOneID(id uuid.UUID) *TimestampDeleteOne {
	builder := c.Delete().Where(timestamp.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &TimestampDeleteOne{builder}
}

// Query returns a query builder for Timestamp.
func (c *TimestampClient) Query() *TimestampQuery {
	return &TimestampQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeTimestamp},
		inters: c.Interceptors(),
	}
}

// Get returns a Timestamp entity by its id.
func (c *TimestampClient) Get(ctx context.Context, id uuid.UUID) (*Timestamp, error) {
	return c.Query().Where(timestamp.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *TimestampClient) GetX(ctx context.Context, id uuid.UUID) *Timestamp {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QuerySignature queries the signature edge of a Timestamp.
func (c *TimestampClient) QuerySignature(_m *Timestamp) *SignatureQuery {
	query := (&SignatureClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := _m.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(timestamp.Table, timestamp.FieldID, id),
			sqlgraph.To(signature.Table, signature.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, timestamp.SignatureTable, timestamp.SignatureColumn),
		)
		fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *TimestampClient) Hooks() []Hook {
	return c.hooks.Timestamp
}

// Interceptors returns the client interceptors.
func (c *TimestampClient) Interceptors() []Interceptor {
	return c.inters.Timestamp
}

func (c *TimestampClient) mutate(ctx context.Context, m *TimestampMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&TimestampCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&TimestampUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&TimestampUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&TimestampDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown Timestamp mutation op: %q", m.Op())
	}
}

// hooks and interceptors per client, for fast access.
type (
	hooks struct {
		Attestation, AttestationCollection, AttestationPolicy, Dsse, PayloadDigest,
		Signature, Statement, Subject, SubjectDigest, Timestamp []ent.Hook
	}
	inters struct {
		Attestation, AttestationCollection, AttestationPolicy, Dsse, PayloadDigest,
		Signature, Statement, Subject, SubjectDigest, Timestamp []ent.Interceptor
	}
)
