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 WxCardUser struct {
	ent.Schema
}

func (WxCardUser) Fields() []ent.Field {
	return []ent.Field{
		field.String("wxid").Default("").Default("").Comment("微信id"),
		field.String("account").Default("").Comment("微信号"),
		field.String("avatar").Default("").Comment("头像"),
		field.String("nickname").Default("").Comment("昵称"),
		field.String("remark").Default("").Comment("备注名"),
		field.String("phone").Default("").Comment("手机号"),
		field.String("open_id").Default("").Comment("OpenID"),
		field.String("union_id").Default("").Comment("UnionID"),
		field.String("session_key").Default("").Comment("SessionKey"),
		field.Int("is_vip").Default(0).Comment("是否VIP：0-否 1-是"),
	}
}

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

func (WxCardUser) Indexes() []ent.Index {
	return []ent.Index{
		index.Fields("wxid", "open_id"),
	}
}

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

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