package schema

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

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

type ContactFieldTemplate struct {
	ent.Schema
}

func (ContactFieldTemplate) Fields() []ent.Field {
	return []ent.Field{
		field.Uint64("organization_id").Default(1).
			Comment("机构 ID").
			Annotations(entsql.WithComments(true)),
		field.JSON("template", []custom_types.ContactFieldTemplate{}).
			Annotations(entsql.WithComments(true)).
			Comment("模板"),
	}
}

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

func (ContactFieldTemplate) Indexes() []ent.Index {
	return []ent.Index{}
}

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

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