import { BaseQueryParams, BaseQueryRequest } from '../base';

export enum TenantStatusEnum {
  NORMAL = 'NORMAL',
  DISABLED = 'DISABLED',
  EXPIRED = 'EXPIRED',
}

export enum UserStatusEnum {
  NORMAL = 'NORMAL',
  DISABLED = 'DISABLED',
  EXPIRED = 'EXPIRED',
}

export interface TenantDTO {
  id: string;
  name: string;
  icon: string;
  tenantCode: string;
  enabled: boolean;
  description: string;
  defaultConfig: string;
  tenantExpireTime: string;
  createTime: string;
  tenantStatus: TenantStatusEnum;
}

export interface TenantRequestDTO {
  id?: string;
  icon?: string;
  name: string;
  enabled: boolean;
  description: string;
  tenantExpireTime?: string;
}

export interface TenantPageRequestParams extends BaseQueryParams {
  tenantName?: string;
}

export interface TenantAdminPageRequestParams extends BaseQueryParams {
  realName?: string;
  tenantId?: string;
  items?: string[];
}

export interface tenantProfileDTO {
  name?: string;
  isolatedTbCore?: boolean;
  isolatedTbRuleEngine?: boolean;
  profileData: {
    configuration: {
      maxDevices?: 1;
      maxAssets?: string;
      maxCustomers?: string;
      maxUsers?: string;
      maxDashboards?: string;
      maxRuleChains?: string;
      maxResourcesInBytes?: string;
      maxOtaPackagesInBytes?: string;
      transportTenantMsgRateLimit?: string;
      transportTenantTelemetryMsgRateLimit?: string;
      transportTenantTelemetryDataPointsRateLimit?: string;
      transportDeviceMsgRateLimit?: string;
      transportDeviceTelemetryMsgRateLimit?: string;
      transportDeviceTelemetryDataPointsRateLimit?: string;
      maxTransportMessages?: string;
      maxTransportDataPoints?: string;
      maxREExecutions?: string;
      maxJSExecutions?: string;
      maxDPStorageDays?: string;
      maxRuleNodeExecutionsPerMessage?: string;
      maxEmails?: string;
      maxSms?: string;
      maxCreatedAlarms?: string;
      defaultStorageTtlDays?: string;
      alarmsTtlDays?: string;
      rpcTtlDays?: string;
      type: 'DEFAULT';
    };
  };
  description: null;
}
export interface UserDTO {
  id: string;
  username: string;
  realName: string;
  phoneNumber: string;
  email: string;
  avatar: string;
  enabled: boolean;
  accountExpireTime: string;
  createTime: string;
  updateTime: string;
  userStatusEnum: UserStatusEnum;
  hasPassword?: boolean;
}

export enum MessageTypeEnum {
  EMAIL_MESSAGE = 'EMAIL_MESSAGE',
  PHONE_MESSAGE = 'PHONE_MESSAGE',
}

export class SendResetPasswordEmailMsg {
  userId: string;
  messageTypeEnum: MessageTypeEnum;

  constructor(userId: string, msgType: MessageTypeEnum) {
    this.userId = userId;
    this.messageTypeEnum = msgType;
  }
}

export class TenantPageRequest extends BaseQueryRequest {
  tenantName: string | undefined;

  constructor(page = 1, pageSize = 10, tenantName?: string) {
    super(page, pageSize);
    this.tenantName = tenantName;
  }

  setTenantName(tenantName: string) {
    this.tenantName = tenantName;
  }
}
