package entity

import (
	"gateway/internal/model/member/domain/enum"

	"go.mongodb.org/mongo-driver/v2/bson"
)

// Member is the tenant-scoped member profile document.
type Member struct {
	ID                      bson.ObjectID     `bson:"_id,omitempty"`
	TenantID                string            `bson:"tenant_id"`
	UID                     string            `bson:"uid"`
	ZitadelUserID           string            `bson:"zitadel_user_id,omitempty"`
	ZitadelEmail            string            `bson:"zitadel_email,omitempty"`
	DisplayName             string            `bson:"display_name,omitempty"`
	Avatar                  string            `bson:"avatar,omitempty"`
	Phone                   string            `bson:"phone,omitempty"`
	Language                string            `bson:"language,omitempty"`
	Currency                string            `bson:"currency,omitempty"`
	Status                  enum.MemberStatus `bson:"member_status"`
	Origin                  enum.MemberOrigin `bson:"origin"`
	PasswordHash            string            `bson:"password_hash,omitempty"`
	BusinessEmail           string            `bson:"business_email,omitempty"`
	BusinessEmailVerified   bool              `bson:"business_email_verified"`
	BusinessEmailVerifiedAt int64             `bson:"business_email_verified_at,omitempty"`
	BusinessPhone           string            `bson:"business_phone,omitempty"`
	BusinessPhoneVerified   bool              `bson:"business_phone_verified"`
	BusinessPhoneVerifiedAt int64             `bson:"business_phone_verified_at,omitempty"`
	TOTPEnrolled            bool              `bson:"totp_enrolled"`
	TOTPSecretCipher        []byte            `bson:"totp_secret_cipher,omitempty"`
	TOTPEnrolledAt          int64             `bson:"totp_enrolled_at,omitempty"`
	TOTPBackupCodesHash     []string          `bson:"totp_backup_codes_hash,omitempty"`
	SuspendReason           string            `bson:"suspend_reason,omitempty"`
	CreateAt                int64             `bson:"create_at"`
	UpdateAt                int64             `bson:"update_at"`
	DeletedAt               int64             `bson:"deleted_at,omitempty"`
	AnonymizedAt            int64             `bson:"anonymized_at,omitempty"`
}

// CollectionName returns the MongoDB collection for members.
func (Member) CollectionName() string {
	return "members"
}
