package schema

import (
	"time"

	"entgo.io/ent"
	"entgo.io/ent/schema/field"
)

// UserVerifications holds the schema definition for the UserVerifications entity.
type UserVerifications struct {
	ent.Schema
}

type MaterialStruct struct {
	IdCardFront     string   `json:"idCardFront"`
	IdCardBack      string   `json:"idCardBack"`
	GameScreenshots []string `json:"gameScreenshots,omitempty"`
	VoiceDemo       string   `json:"voiceDemo,omitempty"`
}

// Fields of the UserVerifications.
func (UserVerifications) Fields() []ent.Field {
	return []ent.Field{
		field.Int64("id").Immutable().Unique(),
		field.Int64("user_id").Immutable().Unique(),
		field.String("role"),
		field.String("status").Default("pending"),
		field.JSON("materials", MaterialStruct{}),
		field.String("reject_reason").Nillable().Optional(),
		field.Int64("reviewed_by").Nillable().Optional(),
		field.Time("reviewed_at").Nillable().Optional(),
		field.Time("created_at").Immutable().Optional().Default(time.Now),
		field.Time("updated_at").Immutable().Optional().Default(time.Now),
	}
}

// Edges of the UserVerifications.
func (UserVerifications) Edges() []ent.Edge {
	return nil
}
