// Code generated by ent, DO NOT EDIT.

package migrate

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

var (
	// AuditLogsColumns holds the columns for the "audit_logs" table.
	AuditLogsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, Unique: true},
		{Name: "user_id", Type: field.TypeString},
		{Name: "action", Type: field.TypeString},
		{Name: "resource", Type: field.TypeString, Nullable: true},
		{Name: "resource_id", Type: field.TypeString, Nullable: true},
		{Name: "ip_address", Type: field.TypeString, Nullable: true},
		{Name: "user_agent", Type: field.TypeString, Nullable: true},
		{Name: "metadata", Type: field.TypeJSON, Nullable: true},
		{Name: "timestamp", Type: field.TypeTime},
	}
	// AuditLogsTable holds the schema information for the "audit_logs" table.
	AuditLogsTable = &schema.Table{
		Name:       "audit_logs",
		Columns:    AuditLogsColumns,
		PrimaryKey: []*schema.Column{AuditLogsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "auditlog_user_id",
				Unique:  false,
				Columns: []*schema.Column{AuditLogsColumns[1]},
			},
			{
				Name:    "auditlog_resource_id",
				Unique:  false,
				Columns: []*schema.Column{AuditLogsColumns[4]},
			},
			{
				Name:    "auditlog_timestamp",
				Unique:  false,
				Columns: []*schema.Column{AuditLogsColumns[8]},
			},
			{
				Name:    "auditlog_action",
				Unique:  false,
				Columns: []*schema.Column{AuditLogsColumns[2]},
			},
			{
				Name:    "auditlog_resource",
				Unique:  false,
				Columns: []*schema.Column{AuditLogsColumns[3]},
			},
		},
	}
	// PermissionsColumns holds the columns for the "permissions" table.
	PermissionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString, Unique: true},
	}
	// PermissionsTable holds the schema information for the "permissions" table.
	PermissionsTable = &schema.Table{
		Name:       "permissions",
		Columns:    PermissionsColumns,
		PrimaryKey: []*schema.Column{PermissionsColumns[0]},
	}
	// RolesColumns holds the columns for the "roles" table.
	RolesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString, Unique: true},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
	}
	// RolesTable holds the schema information for the "roles" table.
	RolesTable = &schema.Table{
		Name:       "roles",
		Columns:    RolesColumns,
		PrimaryKey: []*schema.Column{RolesColumns[0]},
	}
	// RolePermissionsColumns holds the columns for the "role_permissions" table.
	RolePermissionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "permission_role_permissions", Type: field.TypeString, Nullable: true},
		{Name: "role_role_permissions", Type: field.TypeString, Nullable: true},
		{Name: "role_id", Type: field.TypeString},
		{Name: "permission_id", Type: field.TypeString},
	}
	// RolePermissionsTable holds the schema information for the "role_permissions" table.
	RolePermissionsTable = &schema.Table{
		Name:       "role_permissions",
		Columns:    RolePermissionsColumns,
		PrimaryKey: []*schema.Column{RolePermissionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "role_permissions_permissions_role_permissions",
				Columns:    []*schema.Column{RolePermissionsColumns[1]},
				RefColumns: []*schema.Column{PermissionsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "role_permissions_roles_role_permissions",
				Columns:    []*schema.Column{RolePermissionsColumns[2]},
				RefColumns: []*schema.Column{RolesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "role_permissions_roles_role",
				Columns:    []*schema.Column{RolePermissionsColumns[3]},
				RefColumns: []*schema.Column{RolesColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "role_permissions_permissions_permission",
				Columns:    []*schema.Column{RolePermissionsColumns[4]},
				RefColumns: []*schema.Column{PermissionsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
	}
	// UsersColumns holds the columns for the "users" table.
	UsersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, Unique: true},
		{Name: "email", Type: field.TypeString, Unique: true},
		{Name: "username", Type: field.TypeString, Nullable: true},
		{Name: "first_name", Type: field.TypeString, Nullable: true},
		{Name: "last_name", Type: field.TypeString, Nullable: true},
		{Name: "password_hash", Type: field.TypeString},
		{Name: "verified", Type: field.TypeBool, Default: false},
		{Name: "email_verification_token", Type: field.TypeString, Nullable: true},
		{Name: "password_reset_token", Type: field.TypeString, Nullable: true},
		{Name: "password_reset_expires_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
	}
	// UsersTable holds the schema information for the "users" table.
	UsersTable = &schema.Table{
		Name:       "users",
		Columns:    UsersColumns,
		PrimaryKey: []*schema.Column{UsersColumns[0]},
	}
	// UserRolesColumns holds the columns for the "user_roles" table.
	UserRolesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "role_user_roles", Type: field.TypeString, Nullable: true},
		{Name: "user_user_roles", Type: field.TypeString, Nullable: true},
		{Name: "user_id", Type: field.TypeString},
		{Name: "role_id", Type: field.TypeString},
	}
	// UserRolesTable holds the schema information for the "user_roles" table.
	UserRolesTable = &schema.Table{
		Name:       "user_roles",
		Columns:    UserRolesColumns,
		PrimaryKey: []*schema.Column{UserRolesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "user_roles_roles_user_roles",
				Columns:    []*schema.Column{UserRolesColumns[1]},
				RefColumns: []*schema.Column{RolesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "user_roles_users_user_roles",
				Columns:    []*schema.Column{UserRolesColumns[2]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "user_roles_users_user",
				Columns:    []*schema.Column{UserRolesColumns[3]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "user_roles_roles_role",
				Columns:    []*schema.Column{UserRolesColumns[4]},
				RefColumns: []*schema.Column{RolesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
	}
	// Tables holds all the tables in the schema.
	Tables = []*schema.Table{
		AuditLogsTable,
		PermissionsTable,
		RolesTable,
		RolePermissionsTable,
		UsersTable,
		UserRolesTable,
	}
)

func init() {
	RolePermissionsTable.ForeignKeys[0].RefTable = PermissionsTable
	RolePermissionsTable.ForeignKeys[1].RefTable = RolesTable
	RolePermissionsTable.ForeignKeys[2].RefTable = RolesTable
	RolePermissionsTable.ForeignKeys[3].RefTable = PermissionsTable
	UserRolesTable.ForeignKeys[0].RefTable = RolesTable
	UserRolesTable.ForeignKeys[1].RefTable = UsersTable
	UserRolesTable.ForeignKeys[2].RefTable = UsersTable
	UserRolesTable.ForeignKeys[3].RefTable = RolesTable
}
