package schema

import (
	"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 WpChatroomMember struct {
	ent.Schema
}

func (WpChatroomMember) Fields() []ent.Field {
	return []ent.Field{
		field.String("wx_wxid").Default("").
			Default("").
			Annotations(entsql.WithComments(true)).
			Comment("所属微信id"),
		field.String("wxid").Default("").
			Annotations(entsql.WithComments(true)).
			Comment("微信id"),
		field.String("nickname").Default("").
			Annotations(entsql.WithComments(true)).
			Comment("群昵称"),
		field.String("avatar").Default("").
			Annotations(entsql.WithComments(true)).
			Comment("群头像"),
	}
}

func (WpChatroomMember) Mixin() []ent.Mixin {
	return []ent.Mixin{
		mixins.IDMixin{},
		mixins.StatusMixin{},
	}
}

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

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

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