package com.mosquito.project.domain;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.DisplayName;
import java.time.ZonedDateTime;
import java.util.Set;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * Activity实体测试
 */
@DisplayName("Activity实体测试")
class ActivityTest {

    @Test
    @DisplayName("应该能够创建Activity实例")
    void shouldCreateActivity() {
        // When
        Activity activity = new Activity();
        
        // Then
        assertThat(activity.getId()).isNull();
        assertThat(activity.getRewardMode()).isEqualTo(RewardMode.DIFFERENTIAL);
    }

    @Test
    @DisplayName("应该能够设置和获取基本属性")
    void shouldSetAndGetBasicProperties() {
        // Given
        Activity activity = new Activity();
        String name = "测试活动";
        ZonedDateTime startTime = ZonedDateTime.parse("2025-03-01T10:00:00+08:00");
        ZonedDateTime endTime = ZonedDateTime.parse("2025-03-31T23:59:59+08:00");
        
        // When
        activity.setName(name);
        activity.setStartTime(startTime);
        activity.setEndTime(endTime);
        activity.setId(1L);
        
        // Then
        assertThat(activity.getName()).isEqualTo(name);
        assertThat(activity.getStartTime()).isEqualTo(startTime);
        assertThat(activity.getEndTime()).isEqualTo(endTime);
        assertThat(activity.getId()).isEqualTo(1L);
    }

    @Test
    @DisplayName("应该能够处理RewardMode枚举")
    void shouldHandleRewardMode() {
        // Given
        Activity activity = new Activity();
        
        // When & Then - 默认值应该是DIFFERENTIAL
        assertThat(activity.getRewardMode()).isEqualTo(RewardMode.DIFFERENTIAL);
        
        // When
        activity.setRewardMode(RewardMode.CUMULATIVE);
        
        // Then
        assertThat(activity.getRewardMode()).isEqualTo(RewardMode.CUMULATIVE);
    }

    @Test
    @DisplayName("应该能够设置和获取集合属性")
    void shouldSetAndGetCollectionProperties() {
        // Given
        Activity activity = new Activity();
        Set<Long> targetUserIds = Set.of(1L, 2L, 3L);
        
        // When
        activity.setTargetUserIds(targetUserIds);
        
        // Then
        assertThat(activity.getTargetUserIds()).containsExactlyInAnyOrder(1L, 2L, 3L);
    }
}