package com.cloudhandson.vpdbackoffice.domain.vpd;

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

import java.util.List;
import org.junit.jupiter.api.Test;

class VpdPolicyFormOptionsTest {

  @Test
  void choosesHmmFilterForHmmLeaveObjects() {
    VpdPolicyFormOptions options = new VpdPolicyFormOptions(
        List.of(),
        List.of(),
        List.of(),
        List.of(
            new VpdFunctionOption("ADMIN", null, "CB_AGENT_DOC_VPD_FILTER", "FUNCTION"),
            new VpdFunctionOption("ADMIN", null, "HMM_LEAVE_VPD_FILTER", "FUNCTION")
        ),
        List.of(),
        List.of("SELECT")
    );

    assertThat(options.defaultPermissionFunctionKey("HMM_LEAVE_BALANCES"))
        .isEqualTo("ADMIN.HMM_LEAVE_VPD_FILTER");
    assertThat(options.defaultPermissionFunctionKey("HMM_LEAVE_REQUESTS"))
        .isEqualTo("ADMIN.HMM_LEAVE_VPD_FILTER");
    assertThat(options.defaultPermissionFunctionKey("CB_AGENT_DOCUMENTS"))
        .isEqualTo("ADMIN.CB_AGENT_DOC_VPD_FILTER");
  }
}
