// Code generated by ent, DO NOT EDIT.

package migrate

import (
	"entgo.io/ent/dialect/sql/schema"
	"entgo.io/ent/schema/field"
)

var (
	// AdditionalFieldsColumns holds the columns for the "additional_fields" table.
	AdditionalFieldsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "key", Type: field.TypeBytes},
		{Name: "key_iv", Type: field.TypeBytes},
		{Name: "value", Type: field.TypeBytes},
		{Name: "value_iv", Type: field.TypeBytes},
		{Name: "password_additional_fields", Type: field.TypeUUID, Nullable: true},
	}
	// AdditionalFieldsTable holds the schema information for the "additional_fields" table.
	AdditionalFieldsTable = &schema.Table{
		Name:       "additional_fields",
		Columns:    AdditionalFieldsColumns,
		PrimaryKey: []*schema.Column{AdditionalFieldsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "additional_fields_passwords_additionalFields",
				Columns:    []*schema.Column{AdditionalFieldsColumns[5]},
				RefColumns: []*schema.Column{PasswordsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// ChallengesColumns holds the columns for the "challenges" table.
	ChallengesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "expiry", Type: field.TypeTime},
		{Name: "user_challenges", Type: field.TypeUUID},
	}
	// ChallengesTable holds the schema information for the "challenges" table.
	ChallengesTable = &schema.Table{
		Name:       "challenges",
		Columns:    ChallengesColumns,
		PrimaryKey: []*schema.Column{ChallengesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "challenges_users_challenges",
				Columns:    []*schema.Column{ChallengesColumns[2]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
	}
	// EmailChallengesColumns holds the columns for the "email_challenges" table.
	EmailChallengesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "code", Type: field.TypeBytes, Nullable: true},
		{Name: "challenge_email_challenge", Type: field.TypeUUID, Unique: true, Nullable: true},
	}
	// EmailChallengesTable holds the schema information for the "email_challenges" table.
	EmailChallengesTable = &schema.Table{
		Name:       "email_challenges",
		Columns:    EmailChallengesColumns,
		PrimaryKey: []*schema.Column{EmailChallengesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "email_challenges_challenges_emailChallenge",
				Columns:    []*schema.Column{EmailChallengesColumns[2]},
				RefColumns: []*schema.Column{ChallengesColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// NotesColumns holds the columns for the "notes" table.
	NotesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeBytes},
		{Name: "name_iv", Type: field.TypeBytes},
		{Name: "title", Type: field.TypeBytes},
		{Name: "title_iv", Type: field.TypeBytes},
		{Name: "content", Type: field.TypeBytes},
		{Name: "content_iv", Type: field.TypeBytes},
		{Name: "colour", Type: field.TypeBytes},
		{Name: "colour_iv", Type: field.TypeBytes},
		{Name: "vault_notes", Type: field.TypeUUID, Nullable: true},
	}
	// NotesTable holds the schema information for the "notes" table.
	NotesTable = &schema.Table{
		Name:       "notes",
		Columns:    NotesColumns,
		PrimaryKey: []*schema.Column{NotesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "notes_vaults_notes",
				Columns:    []*schema.Column{NotesColumns[9]},
				RefColumns: []*schema.Column{VaultsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// PasswordsColumns holds the columns for the "passwords" table.
	PasswordsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeBytes},
		{Name: "name_iv", Type: field.TypeBytes},
		{Name: "username", Type: field.TypeBytes},
		{Name: "username_iv", Type: field.TypeBytes},
		{Name: "password", Type: field.TypeBytes},
		{Name: "password_iv", Type: field.TypeBytes},
		{Name: "colour", Type: field.TypeBytes},
		{Name: "colour_iv", Type: field.TypeBytes},
		{Name: "vault_passwords", Type: field.TypeUUID, Nullable: true},
	}
	// PasswordsTable holds the schema information for the "passwords" table.
	PasswordsTable = &schema.Table{
		Name:       "passwords",
		Columns:    PasswordsColumns,
		PrimaryKey: []*schema.Column{PasswordsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "passwords_vaults_passwords",
				Columns:    []*schema.Column{PasswordsColumns[9]},
				RefColumns: []*schema.Column{VaultsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// SessionsColumns holds the columns for the "sessions" table.
	SessionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "n", Type: field.TypeBytes},
		{Name: "e", Type: field.TypeInt},
		{Name: "expiry", Type: field.TypeTime},
		{Name: "user_sessions", Type: field.TypeUUID, Nullable: true},
	}
	// SessionsTable holds the schema information for the "sessions" table.
	SessionsTable = &schema.Table{
		Name:       "sessions",
		Columns:    SessionsColumns,
		PrimaryKey: []*schema.Column{SessionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "sessions_users_sessions",
				Columns:    []*schema.Column{SessionsColumns[4]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// TotpCredentialsColumns holds the columns for the "totp_credentials" table.
	TotpCredentialsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "secret", Type: field.TypeString},
		{Name: "validated", Type: field.TypeBool, Default: false},
		{Name: "challenge_totp_credential", Type: field.TypeUUID, Unique: true, Nullable: true},
		{Name: "user_totp_credential", Type: field.TypeUUID, Unique: true, Nullable: true},
	}
	// TotpCredentialsTable holds the schema information for the "totp_credentials" table.
	TotpCredentialsTable = &schema.Table{
		Name:       "totp_credentials",
		Columns:    TotpCredentialsColumns,
		PrimaryKey: []*schema.Column{TotpCredentialsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "totp_credentials_challenges_totpCredential",
				Columns:    []*schema.Column{TotpCredentialsColumns[3]},
				RefColumns: []*schema.Column{ChallengesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "totp_credentials_users_totpCredential",
				Columns:    []*schema.Column{TotpCredentialsColumns[4]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// UrlsColumns holds the columns for the "urls" table.
	UrlsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "url", Type: field.TypeBytes},
		{Name: "url_iv", Type: field.TypeBytes},
		{Name: "password_urls", Type: field.TypeUUID, Nullable: true},
	}
	// UrlsTable holds the schema information for the "urls" table.
	UrlsTable = &schema.Table{
		Name:       "urls",
		Columns:    UrlsColumns,
		PrimaryKey: []*schema.Column{UrlsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "urls_passwords_urls",
				Columns:    []*schema.Column{UrlsColumns[3]},
				RefColumns: []*schema.Column{PasswordsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// UsersColumns holds the columns for the "users" table.
	UsersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "email", Type: field.TypeString, Unique: true},
		{Name: "strengthened_master_hash", Type: field.TypeBytes},
		{Name: "strengthened_master_hash_salt", Type: field.TypeBytes},
		{Name: "protected_database_key", Type: field.TypeBytes},
		{Name: "protected_database_key_iv", Type: field.TypeBytes},
		{Name: "webauthn_enabled", Type: field.TypeBool, Default: false},
		{Name: "totp_enabled", Type: field.TypeBool, Default: false},
		{Name: "verified", Type: field.TypeBool, Default: false},
	}
	// UsersTable holds the schema information for the "users" table.
	UsersTable = &schema.Table{
		Name:       "users",
		Columns:    UsersColumns,
		PrimaryKey: []*schema.Column{UsersColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "user_email",
				Unique:  true,
				Columns: []*schema.Column{UsersColumns[1]},
			},
		},
	}
	// VaultsColumns holds the columns for the "vaults" table.
	VaultsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "name", Type: field.TypeBytes},
		{Name: "name_iv", Type: field.TypeBytes},
		{Name: "colour", Type: field.TypeBytes},
		{Name: "colour_iv", Type: field.TypeBytes},
		{Name: "user_vaults", Type: field.TypeUUID, Nullable: true},
	}
	// VaultsTable holds the schema information for the "vaults" table.
	VaultsTable = &schema.Table{
		Name:       "vaults",
		Columns:    VaultsColumns,
		PrimaryKey: []*schema.Column{VaultsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "vaults_users_vaults",
				Columns:    []*schema.Column{VaultsColumns[6]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// WebAuthnChallengesColumns holds the columns for the "web_authn_challenges" table.
	WebAuthnChallengesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "sd_challenge", Type: field.TypeString, Nullable: true},
		{Name: "user_id", Type: field.TypeBytes, Nullable: true},
		{Name: "allowed_credential_ids", Type: field.TypeJSON, Nullable: true},
		{Name: "user_verification", Type: field.TypeString, Nullable: true},
		{Name: "extensions", Type: field.TypeJSON, Nullable: true},
		{Name: "challenge_webauthn_challenge", Type: field.TypeUUID, Unique: true, Nullable: true},
	}
	// WebAuthnChallengesTable holds the schema information for the "web_authn_challenges" table.
	WebAuthnChallengesTable = &schema.Table{
		Name:       "web_authn_challenges",
		Columns:    WebAuthnChallengesColumns,
		PrimaryKey: []*schema.Column{WebAuthnChallengesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "web_authn_challenges_challenges_webauthnChallenge",
				Columns:    []*schema.Column{WebAuthnChallengesColumns[6]},
				RefColumns: []*schema.Column{ChallengesColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// WebAuthnCredentialsColumns holds the columns for the "web_authn_credentials" table.
	WebAuthnCredentialsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "credential_id", Type: field.TypeBytes},
		{Name: "public_key", Type: field.TypeBytes},
		{Name: "attestation_type", Type: field.TypeString},
		{Name: "transport", Type: field.TypeJSON},
		{Name: "aaguid", Type: field.TypeBytes},
		{Name: "sign_count", Type: field.TypeUint32},
		{Name: "clone_warning", Type: field.TypeBool},
		{Name: "user_webauthn_credentials", Type: field.TypeUUID},
	}
	// WebAuthnCredentialsTable holds the schema information for the "web_authn_credentials" table.
	WebAuthnCredentialsTable = &schema.Table{
		Name:       "web_authn_credentials",
		Columns:    WebAuthnCredentialsColumns,
		PrimaryKey: []*schema.Column{WebAuthnCredentialsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "web_authn_credentials_users_webauthnCredentials",
				Columns:    []*schema.Column{WebAuthnCredentialsColumns[10]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
	}
	// WebAuthnRegisterChallengesColumns holds the columns for the "web_authn_register_challenges" table.
	WebAuthnRegisterChallengesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "sd_challenge", Type: field.TypeString, Nullable: true},
		{Name: "user_id", Type: field.TypeBytes, Nullable: true},
		{Name: "allowed_credential_ids", Type: field.TypeJSON, Nullable: true},
		{Name: "user_verification", Type: field.TypeString, Nullable: true},
		{Name: "extensions", Type: field.TypeJSON, Nullable: true},
		{Name: "user_webauthn_register_challenges", Type: field.TypeUUID, Nullable: true},
	}
	// WebAuthnRegisterChallengesTable holds the schema information for the "web_authn_register_challenges" table.
	WebAuthnRegisterChallengesTable = &schema.Table{
		Name:       "web_authn_register_challenges",
		Columns:    WebAuthnRegisterChallengesColumns,
		PrimaryKey: []*schema.Column{WebAuthnRegisterChallengesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "web_authn_register_challenges_users_webauthnRegisterChallenges",
				Columns:    []*schema.Column{WebAuthnRegisterChallengesColumns[6]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// Tables holds all the tables in the schema.
	Tables = []*schema.Table{
		AdditionalFieldsTable,
		ChallengesTable,
		EmailChallengesTable,
		NotesTable,
		PasswordsTable,
		SessionsTable,
		TotpCredentialsTable,
		UrlsTable,
		UsersTable,
		VaultsTable,
		WebAuthnChallengesTable,
		WebAuthnCredentialsTable,
		WebAuthnRegisterChallengesTable,
	}
)

func init() {
	AdditionalFieldsTable.ForeignKeys[0].RefTable = PasswordsTable
	ChallengesTable.ForeignKeys[0].RefTable = UsersTable
	EmailChallengesTable.ForeignKeys[0].RefTable = ChallengesTable
	NotesTable.ForeignKeys[0].RefTable = VaultsTable
	PasswordsTable.ForeignKeys[0].RefTable = VaultsTable
	SessionsTable.ForeignKeys[0].RefTable = UsersTable
	TotpCredentialsTable.ForeignKeys[0].RefTable = ChallengesTable
	TotpCredentialsTable.ForeignKeys[1].RefTable = UsersTable
	UrlsTable.ForeignKeys[0].RefTable = PasswordsTable
	VaultsTable.ForeignKeys[0].RefTable = UsersTable
	WebAuthnChallengesTable.ForeignKeys[0].RefTable = ChallengesTable
	WebAuthnCredentialsTable.ForeignKeys[0].RefTable = UsersTable
	WebAuthnRegisterChallengesTable.ForeignKeys[0].RefTable = UsersTable
}
