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"
	"wechat-api/ent/schema/localmixin"
)

type EmployeeConfig struct {
	ent.Schema
}

func (EmployeeConfig) Fields() []ent.Field {
	return []ent.Field{
		field.String("stype").Default("").Comment("类型：scene-场景 switch_in-接入方式"),
		field.String("title").Default("").Comment("标题"),
		field.String("photo").Default("").Comment("图片地址"),
		field.Uint64("organization_id").Optional().Default(1).Comment("机构 ID"),
	}
}

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

func (EmployeeConfig) Indexes() []ent.Index {
	return []ent.Index{
		index.Fields("stype"),
	}
}

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

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