package com.zioinfo.kintex.visitor.membership;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
 * F-C6 멤버십 등급 산정 단위테스트 — 재방문·바이어 인증·VIP 부여 기반.
 */
class MembershipTierTest {

    @Test
    void generalByDefault() {
        assertEquals("GENERAL", MembershipTier.of(0, false, false));
        assertEquals("GENERAL", MembershipTier.of(4, false, false));
    }

    @Test
    void buyerWhenVerified() {
        assertEquals("BUYER", MembershipTier.of(1, true, false));
    }

    @Test
    void vipByVisitsOrGrant() {
        assertEquals("VIP", MembershipTier.of(5, false, false));   // 방문 5회
        assertEquals("VIP", MembershipTier.of(0, true, true));     // 수동 부여
        assertEquals("VIP", MembershipTier.of(9, true, false));    // VIP가 BUYER보다 우선
    }

    @Test
    void visitsToNextTier() {
        assertEquals(5, MembershipTier.visitsToNextTier("GENERAL", 0));
        assertEquals(2, MembershipTier.visitsToNextTier("BUYER", 3));
        assertEquals(0, MembershipTier.visitsToNextTier("VIP", 10));
    }

    @Test
    void labels() {
        assertEquals("일반", MembershipTier.label("GENERAL"));
        assertEquals("바이어", MembershipTier.label("BUYER"));
        assertEquals("VIP", MembershipTier.label("VIP"));
    }
}
