package schema

import (
	"wechat-api/ent/schema/localmixin"

	"entgo.io/ent"
	"entgo.io/ent/dialect/entsql"
	"entgo.io/ent/schema"
	"entgo.io/ent/schema/field"
	"entgo.io/ent/schema/index"
	"github.com/suyuan32/simple-admin-common/orm/ent/mixins"
)

type WxCardVisit struct {
	ent.Schema
}

func (WxCardVisit) Fields() []ent.Field {
	return []ent.Field{
		field.Uint64("user_id").Optional().Default(0).Comment("user表ID"),
		field.Uint64("bot_id").Default(0).Comment("被访ID"),
		field.Uint8("bot_type").Default(0).Comment("类型:1-微信 2-小程序 3-智能体"),
	}
}

func (WxCardVisit) Mixin() []ent.Mixin {
	return []ent.Mixin{
		mixins.IDMixin{},
		localmixin.SoftDeleteMixin{},
	}
}

func (WxCardVisit) Indexes() []ent.Index {
	return []ent.Index{
		index.Fields("user_id"),
		index.Fields("bot_id", "bot_type"),
	}
}

func (WxCardVisit) Edges() []ent.Edge {
	return nil
}

func (WxCardVisit) Annotations() []schema.Annotation {
	return []schema.Annotation{
		entsql.WithComments(true),
		entsql.Annotation{Table: "wx_card_visit"},
	}
}
