// Code generated by ent, DO NOT EDIT.

package contact

import (
	"time"

	"entgo.io/ent"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
)

const (
	// Label holds the string label denoting the contact type in the database.
	Label = "contact"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldCreatedAt holds the string denoting the created_at field in the database.
	FieldCreatedAt = "created_at"
	// FieldUpdatedAt holds the string denoting the updated_at field in the database.
	FieldUpdatedAt = "updated_at"
	// FieldStatus holds the string denoting the status field in the database.
	FieldStatus = "status"
	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
	FieldDeletedAt = "deleted_at"
	// FieldWxWxid holds the string denoting the wx_wxid field in the database.
	FieldWxWxid = "wx_wxid"
	// FieldType holds the string denoting the type field in the database.
	FieldType = "type"
	// FieldWxid holds the string denoting the wxid field in the database.
	FieldWxid = "wxid"
	// FieldAccount holds the string denoting the account field in the database.
	FieldAccount = "account"
	// FieldNickname holds the string denoting the nickname field in the database.
	FieldNickname = "nickname"
	// FieldMarkname holds the string denoting the markname field in the database.
	FieldMarkname = "markname"
	// FieldHeadimg holds the string denoting the headimg field in the database.
	FieldHeadimg = "headimg"
	// FieldSex holds the string denoting the sex field in the database.
	FieldSex = "sex"
	// FieldStarrole holds the string denoting the starrole field in the database.
	FieldStarrole = "starrole"
	// FieldDontseeit holds the string denoting the dontseeit field in the database.
	FieldDontseeit = "dontseeit"
	// FieldDontseeme holds the string denoting the dontseeme field in the database.
	FieldDontseeme = "dontseeme"
	// FieldLag holds the string denoting the lag field in the database.
	FieldLag = "lag"
	// FieldGid holds the string denoting the gid field in the database.
	FieldGid = "gid"
	// FieldGname holds the string denoting the gname field in the database.
	FieldGname = "gname"
	// FieldV3 holds the string denoting the v3 field in the database.
	FieldV3 = "v3"
	// FieldOrganizationID holds the string denoting the organization_id field in the database.
	FieldOrganizationID = "organization_id"
	// EdgeContactRelationships holds the string denoting the contact_relationships edge name in mutations.
	EdgeContactRelationships = "contact_relationships"
	// EdgeContactMessages holds the string denoting the contact_messages edge name in mutations.
	EdgeContactMessages = "contact_messages"
	// Table holds the table name of the contact in the database.
	Table = "contact"
	// ContactRelationshipsTable is the table that holds the contact_relationships relation/edge.
	ContactRelationshipsTable = "label_relationship"
	// ContactRelationshipsInverseTable is the table name for the LabelRelationship entity.
	// It exists in this package in order to avoid circular dependency with the "labelrelationship" package.
	ContactRelationshipsInverseTable = "label_relationship"
	// ContactRelationshipsColumn is the table column denoting the contact_relationships relation/edge.
	ContactRelationshipsColumn = "contact_id"
	// ContactMessagesTable is the table that holds the contact_messages relation/edge.
	ContactMessagesTable = "message_records"
	// ContactMessagesInverseTable is the table name for the MessageRecords entity.
	// It exists in this package in order to avoid circular dependency with the "messagerecords" package.
	ContactMessagesInverseTable = "message_records"
	// ContactMessagesColumn is the table column denoting the contact_messages relation/edge.
	ContactMessagesColumn = "contact_id"
)

// Columns holds all SQL columns for contact fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldStatus,
	FieldDeletedAt,
	FieldWxWxid,
	FieldType,
	FieldWxid,
	FieldAccount,
	FieldNickname,
	FieldMarkname,
	FieldHeadimg,
	FieldSex,
	FieldStarrole,
	FieldDontseeit,
	FieldDontseeme,
	FieldLag,
	FieldGid,
	FieldGname,
	FieldV3,
	FieldOrganizationID,
}

// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
	for i := range Columns {
		if column == Columns[i] {
			return true
		}
	}
	return false
}

// Note that the variables below are initialized by the runtime
// package on the initialization of the application. Therefore,
// it should be imported in the main as follows:
//
//	import _ "wechat-api/ent/runtime"
var (
	Hooks        [1]ent.Hook
	Interceptors [1]ent.Interceptor
	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
	DefaultCreatedAt func() time.Time
	// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
	DefaultUpdatedAt func() time.Time
	// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
	UpdateDefaultUpdatedAt func() time.Time
	// DefaultStatus holds the default value on creation for the "status" field.
	DefaultStatus uint8
	// DefaultWxWxid holds the default value on creation for the "wx_wxid" field.
	DefaultWxWxid string
	// DefaultType holds the default value on creation for the "type" field.
	DefaultType int
	// DefaultWxid holds the default value on creation for the "wxid" field.
	DefaultWxid string
	// DefaultAccount holds the default value on creation for the "account" field.
	DefaultAccount string
	// DefaultNickname holds the default value on creation for the "nickname" field.
	DefaultNickname string
	// DefaultMarkname holds the default value on creation for the "markname" field.
	DefaultMarkname string
	// DefaultHeadimg holds the default value on creation for the "headimg" field.
	DefaultHeadimg string
	// DefaultSex holds the default value on creation for the "sex" field.
	DefaultSex int
	// DefaultStarrole holds the default value on creation for the "starrole" field.
	DefaultStarrole string
	// DefaultDontseeit holds the default value on creation for the "dontseeit" field.
	DefaultDontseeit int
	// DefaultDontseeme holds the default value on creation for the "dontseeme" field.
	DefaultDontseeme int
	// DefaultLag holds the default value on creation for the "lag" field.
	DefaultLag string
	// DefaultGid holds the default value on creation for the "gid" field.
	DefaultGid string
	// DefaultGname holds the default value on creation for the "gname" field.
	DefaultGname string
	// DefaultV3 holds the default value on creation for the "v3" field.
	DefaultV3 string
	// DefaultOrganizationID holds the default value on creation for the "organization_id" field.
	DefaultOrganizationID uint64
)

// OrderOption defines the ordering options for the Contact queries.
type OrderOption func(*sql.Selector)

// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldID, opts...).ToFunc()
}

// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}

// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}

// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStatus, opts...).ToFunc()
}

// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}

// ByWxWxid orders the results by the wx_wxid field.
func ByWxWxid(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldWxWxid, opts...).ToFunc()
}

// ByType orders the results by the type field.
func ByType(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldType, opts...).ToFunc()
}

// ByWxid orders the results by the wxid field.
func ByWxid(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldWxid, opts...).ToFunc()
}

// ByAccount orders the results by the account field.
func ByAccount(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAccount, opts...).ToFunc()
}

// ByNickname orders the results by the nickname field.
func ByNickname(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldNickname, opts...).ToFunc()
}

// ByMarkname orders the results by the markname field.
func ByMarkname(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMarkname, opts...).ToFunc()
}

// ByHeadimg orders the results by the headimg field.
func ByHeadimg(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldHeadimg, opts...).ToFunc()
}

// BySex orders the results by the sex field.
func BySex(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSex, opts...).ToFunc()
}

// ByStarrole orders the results by the starrole field.
func ByStarrole(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStarrole, opts...).ToFunc()
}

// ByDontseeit orders the results by the dontseeit field.
func ByDontseeit(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDontseeit, opts...).ToFunc()
}

// ByDontseeme orders the results by the dontseeme field.
func ByDontseeme(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDontseeme, opts...).ToFunc()
}

// ByLag orders the results by the lag field.
func ByLag(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLag, opts...).ToFunc()
}

// ByGid orders the results by the gid field.
func ByGid(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldGid, opts...).ToFunc()
}

// ByGname orders the results by the gname field.
func ByGname(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldGname, opts...).ToFunc()
}

// ByV3 orders the results by the v3 field.
func ByV3(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldV3, opts...).ToFunc()
}

// ByOrganizationID orders the results by the organization_id field.
func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
}

// ByContactRelationshipsCount orders the results by contact_relationships count.
func ByContactRelationshipsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newContactRelationshipsStep(), opts...)
	}
}

// ByContactRelationships orders the results by contact_relationships terms.
func ByContactRelationships(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newContactRelationshipsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}

// ByContactMessagesCount orders the results by contact_messages count.
func ByContactMessagesCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newContactMessagesStep(), opts...)
	}
}

// ByContactMessages orders the results by contact_messages terms.
func ByContactMessages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newContactMessagesStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newContactRelationshipsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ContactRelationshipsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, ContactRelationshipsTable, ContactRelationshipsColumn),
	)
}
func newContactMessagesStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ContactMessagesInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, ContactMessagesTable, ContactMessagesColumn),
	)
}
