package repository

import (
	"context"

	"gateway/internal/model/member/domain/entity"
	"gateway/internal/model/member/domain/enum"
)

// MemberUpdate carries mutable profile fields for PATCH-style updates.
type MemberUpdate struct {
	DisplayName *string
	Avatar      *string
	Language    *string
	Currency    *string
	Phone       *string
}

// ListMembersFilter scopes a paginated member list query.
type ListMembersFilter struct {
	TenantID string
	Status   enum.MemberStatus
	Offset   int64
	Limit    int64
}

// MemberRepository persists member profiles (Mongo).
type MemberRepository interface {
	Insert(ctx context.Context, member *entity.Member) error
	GetByUID(ctx context.Context, tenantID, uid string) (*entity.Member, error)
	GetByZitadelUserID(ctx context.Context, tenantID, zitadelUserID string) (*entity.Member, error)
	GetByZitadelEmail(ctx context.Context, tenantID, email string) (*entity.Member, error)
	UpdateProfile(ctx context.Context, tenantID, uid string, update *MemberUpdate) (*entity.Member, error)
	UpdateStatus(ctx context.Context, tenantID, uid string, status enum.MemberStatus, suspendReason string) error
	List(ctx context.Context, filter ListMembersFilter) ([]*entity.Member, int64, error)
	SetBusinessEmailVerified(ctx context.Context, tenantID, uid, email string) error
	SetBusinessPhoneVerified(ctx context.Context, tenantID, uid, phone string) error
}
