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

func (WxCard) Fields() []ent.Field {
	return []ent.Field{
		field.Uint64("user_id").Optional().Default(0).Comment("user表ID"),
		field.Uint64("wx_user_id").Optional().Default(0).Comment("wx表ID"),
		field.String("avatar").Default("").Comment("头像"),
		field.String("logo").Default("").Comment("logo"),
		field.String("name").Default("").Comment("名称"),
		field.String("company").Default("").Comment("公司"),
		field.String("address").Default("").Comment("地址"),
		field.String("phone").Default("").Comment("手机号"),
		field.String("official_account").Default("").Comment("公众号"),
		field.String("wechat_account").Default("").Comment("微信号"),
		field.String("email").Optional().Default("").Comment("邮箱"),
		field.String("api_base").Optional().Comment("fastgpt-base"),
		field.String("api_key").Optional().Comment("fastgpt-key"),
		field.String("ai_info").Optional().Comment("AI信息"),
		field.String("intro").Optional().Default("").Comment("个人介绍"),
	}
}

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

func (WxCard) Indexes() []ent.Index {
	return []ent.Index{
		index.Fields("user_id"),
		index.Fields("wx_user_id"),
	}
}

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

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