package io.aiven.klaw;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.aiven.klaw.constants.TestConstants;
import io.aiven.klaw.dao.Acl;
import io.aiven.klaw.dao.AclRequests;
import io.aiven.klaw.dao.ActivityLog;
import io.aiven.klaw.dao.Env;
import io.aiven.klaw.dao.EnvTag;
import io.aiven.klaw.dao.KwClusters;
import io.aiven.klaw.dao.KwKafkaConnector;
import io.aiven.klaw.dao.KwTenants;
import io.aiven.klaw.dao.MessageSchema;
import io.aiven.klaw.dao.RegisterUserInfo;
import io.aiven.klaw.dao.SchemaRequest;
import io.aiven.klaw.dao.ServiceAccounts;
import io.aiven.klaw.dao.Team;
import io.aiven.klaw.dao.Topic;
import io.aiven.klaw.dao.TopicRequest;
import io.aiven.klaw.dao.UserInfo;
import io.aiven.klaw.model.*;
import io.aiven.klaw.model.charts.ChartsJsOverview;
import io.aiven.klaw.model.charts.Options;
import io.aiven.klaw.model.charts.TeamOverview;
import io.aiven.klaw.model.charts.Title;
import io.aiven.klaw.model.cluster.LoadTopicsResponse;
import io.aiven.klaw.model.cluster.SchemaInfoOfTopic;
import io.aiven.klaw.model.cluster.SchemasInfoOfClusterResponse;
import io.aiven.klaw.model.cluster.consumergroup.OffsetResetType;
import io.aiven.klaw.model.cluster.consumergroup.OffsetsTiming;
import io.aiven.klaw.model.enums.AclIPPrincipleType;
import io.aiven.klaw.model.enums.AclPatternType;
import io.aiven.klaw.model.enums.AclPermissionType;
import io.aiven.klaw.model.enums.AclType;
import io.aiven.klaw.model.enums.EntityType;
import io.aiven.klaw.model.enums.KafkaClustersType;
import io.aiven.klaw.model.enums.KafkaFlavors;
import io.aiven.klaw.model.enums.KafkaSupportedProtocol;
import io.aiven.klaw.model.enums.MetadataOperationType;
import io.aiven.klaw.model.enums.NewUserStatus;
import io.aiven.klaw.model.enums.OperationalRequestType;
import io.aiven.klaw.model.enums.PermissionType;
import io.aiven.klaw.model.enums.RequestEntityType;
import io.aiven.klaw.model.enums.RequestOperationType;
import io.aiven.klaw.model.enums.RequestStatus;
import io.aiven.klaw.model.enums.SchemaType;
import io.aiven.klaw.model.requests.AclRequestsModel;
import io.aiven.klaw.model.requests.ChangePasswordRequestModel;
import io.aiven.klaw.model.requests.ConsumerOffsetResetRequestModel;
import io.aiven.klaw.model.requests.EnvModel;
import io.aiven.klaw.model.requests.ProfileModel;
import io.aiven.klaw.model.requests.ResetEntityCache;
import io.aiven.klaw.model.requests.SchemaPromotion;
import io.aiven.klaw.model.requests.SchemaRequestModel;
import io.aiven.klaw.model.requests.TeamModel;
import io.aiven.klaw.model.requests.TopicCreateRequestModel;
import io.aiven.klaw.model.requests.TopicUpdateRequestModel;
import io.aiven.klaw.model.requests.UserInfoModel;
import io.aiven.klaw.model.response.AclOverviewInfo;
import io.aiven.klaw.model.response.AclRequestsResponseModel;
import io.aiven.klaw.model.response.EnvIdInfo;
import io.aiven.klaw.model.response.EnvModelResponse;
import io.aiven.klaw.model.response.RequestEntityStatusCount;
import io.aiven.klaw.model.response.RequestStatusCount;
import io.aiven.klaw.model.response.RequestsCountOverview;
import io.aiven.klaw.model.response.RequestsOperationTypeCount;
import io.aiven.klaw.model.response.SchemaRequestsResponseModel;
import io.aiven.klaw.model.response.SchemaSubjectInfoResponse;
import io.aiven.klaw.model.response.SyncSchemasList;
import io.aiven.klaw.model.response.TeamModelResponse;
import io.aiven.klaw.model.response.TopicConfig;
import io.aiven.klaw.model.response.TopicOverview;
import io.aiven.klaw.model.response.TopicRequestsResponseModel;
import io.aiven.klaw.model.response.UserInfoModelResponse;
import java.nio.charset.StandardCharsets;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.util.codec.binary.Base64;
import org.junit.jupiter.api.Assertions;
import org.springframework.http.HttpHeaders;

@Slf4j
public class UtilMethods {

  private static final int TEST_TENANT_ID = 101;

  public HttpHeaders createHeaders(String username, String password) {
    return new HttpHeaders() {
      {
        String auth = username + ":" + password;
        byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.US_ASCII), false);
        String authHeader = "Basic " + new String(encodedAuth);
        set("Authorization", authHeader);
      }
    };
  }

  public List<MessageSchema> getMSchemas() {
    List<MessageSchema> listMSchemas = new ArrayList<>();
    MessageSchema mSchema = new MessageSchema();
    mSchema.setEnvironment("DEV");
    mSchema.setSchemaversion("1.0");
    mSchema.setTopicname("testtopic");
    mSchema.setSchemafull("schema");
    mSchema.setTenantId(TEST_TENANT_ID);
    listMSchemas.add(mSchema);

    return listMSchemas;
  }

  public ProfileModel getUserInfoToUpdateMock() {
    ProfileModel userInfo = new ProfileModel();
    userInfo.setMailid("test@test.com");
    userInfo.setFullname("My full name");

    return userInfo;
  }

  public UserInfoModel getUserInfoMock() {
    UserInfoModel userInfo = new UserInfoModel();
    userInfo.setUsername("kwusera");
    userInfo.setTeamId(101);
    userInfo.setTenantId(TEST_TENANT_ID);
    userInfo.setRole("USER");
    userInfo.setMailid("test@test.com");
    userInfo.setFullname("My full name");
    userInfo.setUserPassword("mypwadaSdas32@#");

    return userInfo;
  }

  public UserInfoModelResponse getUserInfoMockResponse() {
    UserInfoModelResponse userInfo = new UserInfoModelResponse();
    userInfo.setTeam("Seahorses");
    userInfo.setUsername("kwusera");
    userInfo.setTeamId(101);
    userInfo.setTenantId(TEST_TENANT_ID);
    userInfo.setRole("USER");
    userInfo.setMailid("test@test.com");
    userInfo.setFullname("My full name");
    userInfo.setUserPassword("mypwadasdas");

    return userInfo;
  }

  public UserInfo getUserInfoMockDao() {
    UserInfo userInfo = new UserInfo();
    userInfo.setTeamId(3);
    userInfo.setUsername("kwusera");
    userInfo.setTenantId(TEST_TENANT_ID);
    userInfo.setRole("USER");

    return userInfo;
  }

  public List<UserInfo> getUserInfoList(String username, String role) {
    List<UserInfo> userInfoList = new ArrayList<>();
    UserInfo userInfo = new UserInfo();
    userInfo.setTeamId(3);
    userInfo.setUsername(username);
    userInfo.setRole(role);
    userInfoList.add(userInfo);

    return userInfoList;
  }

  public List<UserInfo> getUserInfoList(int count, String usernamePrefix) {
    List<UserInfo> userInfoList = new ArrayList<>();
    for (int i = 0; i < count; i++) {
      UserInfo userInfo = new UserInfo();
      userInfo.setTeamId(i % 2);
      userInfo.setSwitchAllowedTeamIds(Set.of((i + 1) % 2));
      userInfo.setSwitchTeams(true);
      userInfo.setUsername(usernamePrefix + i);
      userInfoList.add(userInfo);
    }

    return userInfoList;
  }

  public List<UserInfoModelResponse> getUserInfoListModel(String username, String role) {
    List<UserInfoModelResponse> userInfoList = new ArrayList<>();
    UserInfoModelResponse userInfo = new UserInfoModelResponse();
    userInfo.setTeam("Seahorses");
    userInfo.setUsername(username);
    userInfo.setRole(role);
    userInfoList.add(userInfo);

    return userInfoList;
  }

  public RegisterUserInfo getRegisterUserInfoMock(String newUserName, String pwd) {
    RegisterUserInfo regUser = new RegisterUserInfo();
    regUser.setUsername(newUserName);
    regUser.setFullname("John Doe");
    regUser.setStatus(NewUserStatus.PENDING.value);
    regUser.setPwd(pwd);
    regUser.setMailid("mail@mail.com");
    regUser.setTeamId(TEST_TENANT_ID + 1);
    regUser.setTenantId(TEST_TENANT_ID);
    regUser.setRole("USER");
    return regUser;
  }

  public List<RegisterUserInfo> getRegisterUserInfoList(
      Map<Integer, String> tenantMapMock, int count, String usernamePrefix) {
    List<RegisterUserInfo> userInfoList = new ArrayList<>();
    for (int i = 0; i < count; i++) {
      RegisterUserInfo userInfo = new RegisterUserInfo();
      userInfo.setTeamId(i + 1);
      userInfo.setUsername(usernamePrefix + i);
      userInfo.setMailid(String.format("%s@mail.com", userInfo.getUsername()));
      userInfo.setStatus(NewUserStatus.PENDING.value);
      userInfo.setTenantId(i + count);
      userInfoList.add(userInfo);

      tenantMapMock.put(userInfo.getTenantId(), String.format("tenant%s", userInfo.getTenantId()));
    }

    return userInfoList;
  }

  public Team getTeamDaoMock() {
    ServiceAccounts serviceAccounts = new ServiceAccounts();
    serviceAccounts.setNumberOfAllowedAccounts(-1);

    Team team = new Team();
    team.setTeamname("Seahorses");
    team.setTeamId(3);
    team.setContactperson("Contact Person");
    team.setTenantId(TEST_TENANT_ID);
    team.setTeamphone("3142342343242");
    team.setTeammail("team@teammail.com");
    team.setApp("app");
    team.setRequestTopicsEnvs("1,2,3");
    team.setRestrictionsObj("restrictionsObj");
    team.setServiceAccounts(serviceAccounts);
    team.setOtherParams("otherParams");

    return team;
  }

  public Map<Integer, String> getTenantMapMock() {
    Map<Integer, String> tenantMap = new HashMap<>();
    tenantMap.put(TEST_TENANT_ID, "testTenantName");

    return tenantMap;
  }

  public List<ActivityLog> getLogs() {
    List<ActivityLog> activityLogs = new ArrayList<>();
    ActivityLog activityLog = new ActivityLog();
    activityLog.setActivityTime(new Timestamp(System.currentTimeMillis()));
    activityLogs.add(activityLog);
    return activityLogs;
  }

  public List<ActivityLogModel> getLogModels() {
    List<ActivityLogModel> activityLogs = new ArrayList<>();
    ActivityLogModel activityLog = new ActivityLogModel();
    activityLog.setActivityTime(new Timestamp(System.currentTimeMillis()));
    activityLogs.add(activityLog);
    return activityLogs;
  }

  public Topic getTopic(String topicName) {
    Topic topic = new Topic();
    topic.setTeamId(3);
    topic.setTopicname(topicName);

    return topic;
  }

  public int getSchemaRequestPk() {

    return 1001;
  }

  public List<Topic> getTopics() {
    List<Topic> allTopicReqs = new ArrayList<>();
    Topic topicRequest = new Topic();
    topicRequest.setEnvironment("1");
    topicRequest.setTopicname("testtopic");
    topicRequest.setTeamId(3);
    topicRequest.setNoOfPartitions(1);
    topicRequest.setTenantId(TEST_TENANT_ID);
    allTopicReqs.add(topicRequest);
    return allTopicReqs;
  }

  public List<Topic> getTopics(String topicName) {
    List<Topic> allTopicReqs = new ArrayList<>();
    Topic topicRequest = new Topic();
    topicRequest.setEnvironment("1");
    topicRequest.setTopicname(topicName);

    topicRequest.setTeamId(3);
    allTopicReqs.add(topicRequest);
    return allTopicReqs;
  }

  public List<Topic> getTopicInMultipleEnvs(String topicName, int teamId, int sizeOfTopics) {
    List<Topic> topicList = new ArrayList<>();
    for (int i = 0; i < sizeOfTopics; i++) {
      Topic topic1 = new Topic();
      topic1.setEnvironment(i + 1 + "");
      topic1.setTopicname(topicName);

      topic1.setTeamId(teamId);
      topicList.add(topic1);
    }

    return topicList;
  }

  public List<Topic> getMultipleTopics(String topicPrefix, int size, String env, int teamId) {
    List<Topic> listTopics = new ArrayList<>();
    Topic t;
    if (env == null) {
      env = "1";
    }

    if (teamId == 0) {
      teamId = 101;
    }

    for (int i = 0; i < size; i++) {
      t = new Topic();

      t.setTopicname(topicPrefix + i);
      t.setTopicid(i);
      t.setEnvironment(env);
      t.setTeamId(teamId);
      t.setEnvironmentsSet(new HashSet<>());

      listTopics.add(t);
    }
    return listTopics;
  }

  public List<Acl> getAcls() {
    List<Acl> allTopicReqs = new ArrayList<>();
    Acl topicRequest = new Acl();
    topicRequest.setTeamId(3);
    topicRequest.setAclType(AclType.PRODUCER.value);
    topicRequest.setTenantId(TEST_TENANT_ID);
    allTopicReqs.add(topicRequest);
    return allTopicReqs;
  }

  public List<Acl> getSyncAcls() {
    List<Acl> allTopicReqs = new ArrayList<>();
    Acl acl1 = new Acl();
    acl1.setTeamId(102);
    acl1.setAclType(AclType.PRODUCER.value);
    acl1.setTenantId(TEST_TENANT_ID);
    allTopicReqs.add(acl1);

    Acl acl2 = new Acl();
    acl2.setTeamId(103);
    acl2.setAclType(AclType.CONSUMER.value);
    acl2.setTenantId(TEST_TENANT_ID);
    allTopicReqs.add(acl2);

    return allTopicReqs;
  }

  public List<AclInfo> getAclInfoList() {
    List<AclInfo> allTopicReqs = new ArrayList<>();
    AclInfo topicRequest = new AclInfo();
    topicRequest.setTeamname("Seahorses");
    topicRequest.setTopictype(AclType.PRODUCER.value);
    allTopicReqs.add(topicRequest);
    return allTopicReqs;
  }

  public List<AclOverviewInfo> getAclOverviewInfoList() {
    List<AclOverviewInfo> allTopicReqs = new ArrayList<>();
    AclOverviewInfo topicRequest = new AclOverviewInfo();
    topicRequest.setTeamname("Seahorses");
    topicRequest.setTopictype(AclType.PRODUCER.value);
    allTopicReqs.add(topicRequest);
    return allTopicReqs;
  }

  public List<Map<String, String>> getClusterSyncAcls() {
    Set<Map<String, String>> acls = new HashSet<>();

    HashMap<String, String> aclbindingMap;

    aclbindingMap = new HashMap<>();
    aclbindingMap.put("host", "2.1.2.2");
    aclbindingMap.put("principle", "User:*");
    aclbindingMap.put("operation", AclPermissionType.READ.value);
    aclbindingMap.put("permissionType", "ALLOW");
    aclbindingMap.put("resourceType", "TOPIC");
    aclbindingMap.put("resourceName", "testtopic1001");
    acls.add(aclbindingMap);

    aclbindingMap = new HashMap<>();
    aclbindingMap.put("host", "2.1.2.2");
    aclbindingMap.put("principle", "User:*");
    aclbindingMap.put("operation", AclPermissionType.READ.value);
    aclbindingMap.put("permissionType", "ALLOW");
    aclbindingMap.put("resourceType", "GROUP");
    aclbindingMap.put("resourceName", "mygrp2");
    acls.add(aclbindingMap);

    return new ArrayList<>(acls);
  }

  public List<Map<String, String>> getClusterAcls() {
    Set<Map<String, String>> acls = new HashSet<>();

    HashMap<String, String> aclbindingMap = new HashMap<>();

    aclbindingMap.put("host", "1.1.1.1");
    aclbindingMap.put("principle", "User:*");
    aclbindingMap.put("operation", AclPermissionType.READ.value);
    aclbindingMap.put("permissionType", "ALLOW");
    aclbindingMap.put("resourceType", "GROUP");
    aclbindingMap.put("resourceName", "myconsumergroup1");
    acls.add(aclbindingMap);

    aclbindingMap = new HashMap<>();
    aclbindingMap.put("host", "2.1.2.1");
    aclbindingMap.put("principle", "User:*");
    aclbindingMap.put("operation", AclPermissionType.READ.value);
    aclbindingMap.put("permissionType", "ALLOW");
    aclbindingMap.put("resourceType", "TOPIC");
    aclbindingMap.put("resourceName", "testtopic1");
    acls.add(aclbindingMap);

    aclbindingMap = new HashMap<>();
    aclbindingMap.put("host", "2.1.2.1");
    aclbindingMap.put("principle", "User:*");
    aclbindingMap.put("operation", AclPermissionType.READ.value);
    aclbindingMap.put("permissionType", "ALLOW");
    aclbindingMap.put("resourceType", "GROUP");
    aclbindingMap.put("resourceName", "mygrp1");
    acls.add(aclbindingMap);

    return new ArrayList<>(acls);
  }

  public List<Map<String, String>> getClusterAclsNonApacheKafka() {
    Set<Map<String, String>> acls = new HashSet<>();

    HashMap<String, String> aclbindingMap;

    aclbindingMap = new HashMap<>();
    aclbindingMap.put("host", "*");
    aclbindingMap.put("principle", "testuser1234");
    aclbindingMap.put("consumerGroup", "-na-");
    aclbindingMap.put("operation", AclPermissionType.READ.value);
    aclbindingMap.put("permissionType", "ALLOW");
    aclbindingMap.put("resourceType", "TOPIC");
    aclbindingMap.put("resourceName", "testtopic1");
    aclbindingMap.put("aivenaclid", "aclid12345");

    acls.add(aclbindingMap);

    return new ArrayList<>(acls);
  }

  public List<Map<String, String>> getClusterAcls2() {
    Set<Map<String, String>> acls = new HashSet<>();

    HashMap<String, String> aclbindingMap = new HashMap<>();

    aclbindingMap.put("host", "1.1.1.1");
    aclbindingMap.put("principle", "User:*");
    aclbindingMap.put("operation", AclPermissionType.READ.value);
    aclbindingMap.put("permissionType", "ALLOW");
    aclbindingMap.put("resourceType", "GROUP");
    aclbindingMap.put("resourceName", "myconsumergroup1");
    acls.add(aclbindingMap);

    aclbindingMap = new HashMap<>();
    aclbindingMap.put("host", "2.1.2.1");
    aclbindingMap.put("principle", "User:*");
    aclbindingMap.put("operation", AclPermissionType.READ.value);
    aclbindingMap.put("permissionType", "ALLOW");
    aclbindingMap.put("resourceType", "TOPIC");
    aclbindingMap.put("resourceName", "testtopic");
    acls.add(aclbindingMap);

    aclbindingMap = new HashMap<>();
    aclbindingMap.put("host", "2.1.2.1");
    aclbindingMap.put("principle", "User:*");
    aclbindingMap.put("operation", AclPermissionType.READ.value);
    aclbindingMap.put("permissionType", "ALLOW");
    aclbindingMap.put("resourceType", "GROUP");
    aclbindingMap.put("resourceName", "mygrp1");
    acls.add(aclbindingMap);

    return new ArrayList<>(acls);
  }

  public Set<Map<String, String>> getAclsMock() {
    Set<Map<String, String>> listAcls = new HashSet<>();
    HashMap<String, String> hsMp = new HashMap<>();
    hsMp.put("key", "val");
    listAcls.add(hsMp);

    hsMp = new HashMap<>();
    hsMp.put("key", "val");
    listAcls.add(hsMp);
    return listAcls;
  }

  public List<Acl> getAclsForDelete() {
    List<Acl> allTopicReqs = new ArrayList<>();
    Acl topicRequest = new Acl();
    topicRequest.setTopicname("testtopic");
    topicRequest.setConsumergroup("congrp");
    topicRequest.setEnvironment("1");
    topicRequest.setAclip("12.22.126.21");
    topicRequest.setAclType(AclType.PRODUCER.value);
    allTopicReqs.add(topicRequest);
    return allTopicReqs;
  }

  public List<Acl> getAllAcls() {
    List<Acl> allTopicReqs = new ArrayList<>();
    Acl acl = new Acl();
    acl.setTeamId(3);
    acl.setAclType(AclType.PRODUCER.value);
    allTopicReqs.add(acl);

    acl = new Acl();
    acl.setTopicname("testtopic");
    acl.setConsumergroup("congrp");
    acl.setEnvironment("1");
    acl.setAclip("12.22.126.21");
    acl.setAclType(AclType.PRODUCER.value);
    acl.setOtherParams("101");
    acl.setTeamId(101);
    allTopicReqs.add(acl);

    return allTopicReqs;
  }

  public List<Team> getTeams() {
    List<Team> allTopicReqs = new ArrayList<>();
    Team team = new Team();
    team.setTeamname("Seahorses");
    team.setTeamId(101);
    team.setContactperson("Contact Person");
    team.setTenantId(TEST_TENANT_ID);
    team.setTeamphone("3142342343242");
    team.setTeammail("test@test.com");

    ServiceAccounts serviceAccounts = new ServiceAccounts();
    Set<String> serviceAccountsList = new HashSet<>();
    serviceAccountsList.add("user1");
    serviceAccountsList.add("user2");
    serviceAccounts.setNumberOfAllowedAccounts(25);
    serviceAccounts.setServiceAccountsList(serviceAccountsList);
    team.setServiceAccounts(serviceAccounts);
    allTopicReqs.add(team);

    return allTopicReqs;
  }

  public List<Team> getTeamsForTenant() {
    List<Team> teams = new ArrayList<>();
    Team team1 = new Team();
    team1.setTeamname("Seahorses");
    team1.setTeamId(104);
    team1.setContactperson("Contact Person1");
    team1.setTenantId(TEST_TENANT_ID);
    team1.setTeamphone("3142342343242");
    team1.setTeammail("test1@test.com");

    Team team2 = new Team();
    team2.setTeamname("Octopus");
    team2.setTeamId(102);
    team2.setContactperson("Contact Person2");
    team2.setTenantId(TEST_TENANT_ID);
    team2.setTeamphone("3142342343242");
    team2.setTeammail("test2@test.com");

    Team team3 = new Team();
    team3.setTeamname("Dragons");
    team3.setTeamId(103);
    team3.setContactperson("Contact Person3");
    team3.setTenantId(TEST_TENANT_ID);
    team3.setTeamphone("3142342343242");
    team3.setTeammail("test3@test.com");

    teams.add(team1);
    teams.add(team2);
    teams.add(team3);

    return teams;
  }

  public List<TeamModelResponse> getTeamsModel() {
    List<TeamModelResponse> allTopicReqs = new ArrayList<>();
    TeamModelResponse team = new TeamModelResponse();
    team.setTeamname("Seahorses");
    allTopicReqs.add(team);
    return allTopicReqs;
  }

  public TeamModel getTeamModelMock() {
    TeamModel team = new TeamModel();
    team.setTeamname("Seahorses");
    team.setContactperson("Contact Person");
    team.setTeamphone("314234234");
    team.setTenantId(TEST_TENANT_ID);
    team.setTeamId(3);
    team.setEnvList(List.of("1", "2"));
    return team;
  }

  public ChangePasswordRequestModel getChangePwdRequestModelMock() {
    ChangePasswordRequestModel changePwd = new ChangePasswordRequestModel();
    changePwd.setPwd("newpassworD3@");
    changePwd.setRepeatPwd("newpassworD3@");
    return changePwd;
  }

  public List<TopicRequest> getTopicRequests() {
    List<TopicRequest> allTopicReqs = new ArrayList<>();
    TopicRequest topicRequest = new TopicRequest();
    topicRequest.setTeamId(3);
    topicRequest.setRequestStatus(RequestStatus.CREATED.value);
    topicRequest.setRequesttime(new Timestamp(System.currentTimeMillis()));
    topicRequest.setRequestor("Jackie");
    allTopicReqs.add(topicRequest);
    return allTopicReqs;
  }

  public List<TopicRequestsResponseModel> getTopicRequestsModel() {
    List<TopicRequestsResponseModel> allTopicReqs = new ArrayList<>();
    TopicRequestsResponseModel topicRequest = new TopicRequestsResponseModel();
    topicRequest.setTeamname("Seahorses");
    allTopicReqs.add(topicRequest);
    return allTopicReqs;
  }

  public TopicRequest getTopicRequest(int topicId) {
    TopicRequest topicRequest = new TopicRequest();
    topicRequest.setTopicid(topicId);
    topicRequest.setTeamId(1001); // INFRATEAM
    topicRequest.setRequestor("kwusera");
    topicRequest.setTopicname("testtopic" + topicId);
    topicRequest.setTopicpartitions(2);
    topicRequest.setReplicationfactor("1");
    topicRequest.setEnvironment("1");
    topicRequest.setRequestOperationType(RequestOperationType.CREATE.value);
    topicRequest.setDescription("Test desc");
    topicRequest.setTenantId(TEST_TENANT_ID);
    return topicRequest;
  }

  public TopicCreateRequestModel getTopicCreateRequestModel(int topicId) {
    TopicCreateRequestModel topicRequest = new TopicCreateRequestModel();
    topicRequest.setRequestor("kwusera");
    topicRequest.setTopicname("testtopic" + topicId);
    topicRequest.setTopicpartitions(2);
    topicRequest.setReplicationfactor("1");
    topicRequest.setEnvironment("1");
    topicRequest.setRequestOperationType(RequestOperationType.CREATE);
    topicRequest.setDescription("Test desc");
    topicRequest.setRequestor("kwusera");
    return topicRequest;
  }

  public ConsumerOffsetResetRequestModel getConsumerOffsetResetRequest(int topicId) {
    ConsumerOffsetResetRequestModel consumerOffsetResetRequestModel =
        new ConsumerOffsetResetRequestModel();
    consumerOffsetResetRequestModel.setRequestor("kwusera");
    consumerOffsetResetRequestModel.setTopicname("testtopic" + topicId);
    consumerOffsetResetRequestModel.setEnvironment("1");
    consumerOffsetResetRequestModel.setRequestor("kwusera");
    consumerOffsetResetRequestModel.setOffsetResetType(OffsetResetType.LATEST);
    consumerOffsetResetRequestModel.setConsumerGroup("mygrp1");
    consumerOffsetResetRequestModel.setOperationalRequestType(
        OperationalRequestType.RESET_CONSUMER_OFFSETS);
    return consumerOffsetResetRequestModel;
  }

  public TopicUpdateRequestModel getTopicUpdateRequestModel(int topicId) {
    TopicUpdateRequestModel topicRequest = new TopicUpdateRequestModel();
    topicRequest.setRequestor("kwusera");
    topicRequest.setTopicname("testtopic" + topicId);
    topicRequest.setTopicpartitions(2);
    topicRequest.setReplicationfactor("1");
    topicRequest.setEnvironment("1");
    topicRequest.setRequestOperationType(RequestOperationType.UPDATE);
    topicRequest.setDescription("Test desc");
    return topicRequest;
  }

  public AclRequests getAclRequest(String topicName) {
    AclRequests aclRequest = new AclRequests();
    aclRequest.setTeamId(3);
    aclRequest.setEnvironment("1");
    aclRequest.setTopicname(topicName);
    aclRequest.setRequestor("kwusera");
    aclRequest.setAclType(AclType.CONSUMER.value);
    aclRequest.setRequestOperationType(RequestOperationType.DELETE.value);
    aclRequest.setConsumergroup("congroup1");
    aclRequest.setAcl_ip("10.11.112.113");
    aclRequest.setAclPatternType(AclPatternType.LITERAL.value);
    aclRequest.setOtherParams("101");
    aclRequest.setTenantId(TEST_TENANT_ID);
    return aclRequest;
  }

  public AclRequests getAclRequestCreate(String topicName) {
    AclRequests aclRequest = new AclRequests();
    aclRequest.setTeamId(3);
    aclRequest.setEnvironment("1");
    aclRequest.setTopicname(topicName);
    aclRequest.setRequestor("kwusera");
    aclRequest.setAclType(AclType.CONSUMER.value);
    aclRequest.setRequestOperationType(RequestOperationType.CREATE.value);
    aclRequest.setConsumergroup("congroup1");
    aclRequest.setAcl_ip("10.11.112.113");
    aclRequest.setAclPatternType(AclPatternType.LITERAL.value);
    return aclRequest;
  }

  public List<SchemaRequestModel> getSchemaRequests() {
    List<SchemaRequestModel> schemaList = new ArrayList<>();
    SchemaRequestModel schemaRequest = new SchemaRequestModel();
    schemaRequest.setEnvironment("1");
    schemaRequest.setRequestor("kwusera");
    schemaRequest.setSchemafull("schemafdsfsd");
    schemaRequest.setTeamId(1001);
    schemaRequest.setRemarks("pls approve");
    schemaRequest.setTopicname("testtopic");
    schemaRequest.setSchemaType(SchemaType.AVRO);
    schemaRequest.setRequestOperationType(RequestOperationType.CREATE);
    schemaList.add(schemaRequest);

    return schemaList;
  }

  public List<SchemaRequestsResponseModel> getSchemaRequestsResponse() {
    List<SchemaRequestsResponseModel> schemaList = new ArrayList<>();
    SchemaRequestsResponseModel schemaRequest = new SchemaRequestsResponseModel();
    schemaRequest.setEnvironment("1");
    schemaRequest.setRequestor("kwusera");
    schemaRequest.setSchemafull("schemafdsfsd");
    schemaRequest.setTeamId(1001);
    schemaRequest.setRemarks("pls approve");
    schemaRequest.setTopicname("testtopic");
    schemaList.add(schemaRequest);
    return schemaList;
  }

  public List<SchemaPromotion> getSchemaPromotion() {
    SchemaPromotion promo = new SchemaPromotion();
    promo.setRemarks("Promotion Schema Request");
    promo.setAppName("App");
    promo.setSchemaVersion("1");
    promo.setTopicName("topic-1");
    promo.setForceRegister(false);
    return List.of(promo);
  }

  public List<SchemaRequest> getSchemaRequestsDao() {
    List<SchemaRequest> schemaList = new ArrayList<>();
    SchemaRequest schemaRequest = new SchemaRequest();
    schemaRequest.setEnvironment("1");
    schemaRequest.setTeamId(3);
    schemaRequest.setRequestor("kwusera");
    schemaRequest.setSchemafull("schema");
    schemaRequest.setTenantId(TEST_TENANT_ID);
    schemaList.add(schemaRequest);
    return schemaList;
  }

  public KwKafkaConnector getKwKafkaConnector() {
    KwKafkaConnector kwKafkaConnector = new KwKafkaConnector();
    kwKafkaConnector.setConnectorConfig("config");
    kwKafkaConnector.setConnectorId(101);
    kwKafkaConnector.setConnectorName("testconn");
    kwKafkaConnector.setTenantId(TEST_TENANT_ID);
    kwKafkaConnector.setTeamId(1003);
    return kwKafkaConnector;
  }

  public List<AclRequestsResponseModel> getAclRequestsModel() {
    List<AclRequestsResponseModel> aclRequests = new ArrayList<>();
    AclRequestsResponseModel aclRequests1 = new AclRequestsResponseModel();
    aclRequests1.setTeamname("Seahorses");
    aclRequests1.setRequestingteam(2);
    aclRequests1.setRequestOperationType(RequestOperationType.CREATE);
    aclRequests1.setAclPatternType(AclPatternType.LITERAL.value);
    aclRequests.add(aclRequests1);
    return aclRequests;
  }

  public List<AclRequests> getAclRequests() {
    List<AclRequests> aclRequests = new ArrayList<>();
    AclRequests aclRequests1 = new AclRequests();
    aclRequests1.setTeamId(3);
    aclRequests1.setRequestingteam(3);
    aclRequests1.setRequestOperationType(RequestOperationType.CREATE.value);
    aclRequests1.setAclPatternType(AclPatternType.LITERAL.value);
    aclRequests.add(aclRequests1);
    return aclRequests;
  }

  public List<AclRequestsResponseModel> getAclRequestsList() {
    List<AclRequestsResponseModel> aclRequests = new ArrayList<>();
    AclRequestsResponseModel aclRequests1 = new AclRequestsResponseModel();
    aclRequests1.setTeamname("Seahorses");
    aclRequests1.setRequestingteam(3);
    aclRequests.add(aclRequests1);
    return aclRequests;
  }

  public List<TopicRequestsResponseModel> getTopicRequestsList() {
    List<TopicRequestsResponseModel> allTopicReqs = new ArrayList<>();
    TopicRequestsResponseModel topicRequest = new TopicRequestsResponseModel();
    topicRequest.setTeamname("Seahorses");
    allTopicReqs.add(topicRequest);

    return allTopicReqs;
  }

  public List<List<TopicInfo>> getTopicInfoList() {
    List<List<TopicInfo>> topicReqs = new ArrayList<>();

    List<TopicInfo> allTopicReqs = new ArrayList<>();
    TopicInfo topicRequest = new TopicInfo();
    topicRequest.setTeamname("Seahorses");
    allTopicReqs.add(topicRequest);
    topicReqs.add(allTopicReqs);

    return topicReqs;
  }

  public List<Env> getEnvLists() {
    List<Env> envList = new ArrayList<>();
    Env env = new Env();
    env.setId("1");
    env.setName("DEV");
    envList.add(env);
    env.setClusterId(1);
    env.setTenantId(TEST_TENANT_ID);

    Env env2 = new Env();
    env2.setId("2");
    env2.setName("TST");
    env2.setClusterId(2);
    env2.setTenantId(TEST_TENANT_ID);
    envList.add(env2);

    Env env3 = new Env();
    env3.setId("3");
    env3.setName("PRD");
    env3.setClusterId(3);
    env3.setTenantId(TEST_TENANT_ID);
    envList.add(env3);

    return envList;
  }

  public List<Env> getKafkaEnvs() {
    List<Env> envList = new ArrayList<>();
    Env env = new Env();
    env.setId("1");
    env.setName("DEV");
    envList.add(env);
    env.setClusterId(1);
    env.setTenantId(TEST_TENANT_ID);
    env.setAssociatedEnv(new EnvTag("3", "DEV"));
    return envList;
  }

  public Env getSchemaEnv() {
    Env env = new Env();
    env.setId("3");
    env.setName("DEV");
    env.setClusterId(3);
    env.setTenantId(TEST_TENANT_ID);
    env.setAssociatedEnv(new EnvTag("1", "DEV"));

    return env;
  }

  public List<Env> getEnvListsIncorrect1() {
    List<Env> envList = new ArrayList<>();
    Env env = new Env();
    env.setId("1");
    env.setName("DEV");
    env.setOtherParams("");
    envList.add(env);
    return envList;
  }

  public List<EnvModelResponse> getEnvList() {
    List<EnvModelResponse> envList = new ArrayList<>();
    EnvModelResponse env = new EnvModelResponse();
    env.setId("1");
    env.setName("DEV");
    env.setClusterType(KafkaClustersType.KAFKA);
    env.setClusterId(101);
    envList.add(env);
    return envList;
  }

  public List<EnvModel> getEnvListToAdd() {
    List<EnvModel> envList = new ArrayList<>();
    EnvModel env = new EnvModel();
    env.setId("1");
    env.setName("DEV");
    env.setType(KafkaClustersType.KAFKA.value);
    env.setClusterId(101);
    envList.add(env);
    return envList;
  }

  public List<EnvIdInfo> getSyncEnv() {
    List<EnvIdInfo> envList = new ArrayList<>();

    EnvIdInfo envIdInfo = new EnvIdInfo();
    envIdInfo.setId("1");
    envIdInfo.setName("DEV");
    envList.add(envIdInfo);

    EnvIdInfo envIdInfo1 = new EnvIdInfo();
    envIdInfo1.setId("2");
    envIdInfo1.setName("TST");
    envList.add(envIdInfo1);

    return envList;
  }

  public AclRequestsModel getAclRequestModel(String topic) {
    AclRequestsModel aclRequest = new AclRequestsModel();
    aclRequest.setTeamId(1001);
    aclRequest.setEnvironment("1");
    aclRequest.setTopicname(topic);
    aclRequest.setRequestor("kwusera");
    aclRequest.setAclType(AclType.CONSUMER);
    aclRequest.setConsumergroup("mygrp1");
    ArrayList<String> ipList = new ArrayList<>();
    ipList.add("2.1.2.1");
