package schema

import (
	"entgo.io/ent/schema/index"
	"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 AliyunAvatar struct {
	ent.Schema
}

func (AliyunAvatar) Fields() []ent.Field {
	return []ent.Field{
		field.Uint64("user_id").Comment("user_id | wx_card_user_id"),
		field.String("biz_id").Comment("biz_id | BizId"),
		field.String("access_key_id").Comment("access_key_id | AccessKeyId"),
		field.String("access_key_secret").Comment("access_key_secret | AccessKeySecret"),
		field.String("app_id").Optional().Comment("app_id | AppId"),
		field.Uint64("tenant_id").Comment("tenant_id | TenantId"),
		field.Text("response").Comment("response | 阿里云avatar响应"),
		field.String("token").Default("").Comment("token | Token"),
		field.String("session_id").Default("").Comment("session_id | SessionId"),
	}
}

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

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

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

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