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

func (WhatsappChannel) Fields() []ent.Field {
	return []ent.Field{
		field.String("ak").Optional().Default("").Comment("ak"),
		field.String("sk").Default("").Comment("端口号"),
		field.String("wa_id").Optional().Default("").Comment("通道ID"),
		field.String("wa_name").Optional().Default("").Comment("通道名"),
		field.Uint64("waba_id").Default(0).Comment("WABA ID"),
		field.Uint64("business_id").Default(0).Comment("商业平台ID"),
		field.Uint64("organization_id").Optional().Default(0).Comment("机构 ID"),
		field.String("verify_account").Default("").Comment("认证主体"),
	}
}

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

func (WhatsappChannel) Indexes() []ent.Index {
	return []ent.Index{
		index.Fields("ak", "sk"),
	}
}

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

func (WhatsappChannel) Annotations() []schema.Annotation {
	return []schema.Annotation{
		entsql.Annotation{Table: "whatsapp_channel"},
	}
}
