import { Rule, RuleType } from '@midwayjs/validate';
import { ApiProperty } from '@midwayjs/swagger';
import { ErrorCode, ServiceError } from '../../error/service.error';
import { dealVO } from '../../frame/VOBase';
export class FVO_admin {
  constructor(data: object) {
    dealVO(this, data);
  }
  @ApiProperty({ description: '数据id' })
  id: number = undefined;
  @ApiProperty({ description: '管理员名称' })
  'nick_name': string = undefined;
  @ApiProperty({ description: '账号' })
  'account': string = undefined;
  @ApiProperty({ description: '密码' })
  'password': string = undefined;
  @ApiProperty({ description: '拥有角色' })
  'role': Array<any> = undefined;
  @ApiProperty({ description: '所属部门' })
  'dept': number = undefined;
  @ApiProperty({ description: '是否是超级管理员' })
  'is_super': string = undefined;
  @ApiProperty({ description: '使用状态' })
  'is_use': string = undefined;
}

export class QDTO_admin {}

export class QVO_admin extends FVO_admin {
  constructor(data: object) {
    super(data);
    dealVO(this, data);
  }
}

export class CDTO_admin {
  @ApiProperty({ description: '管理员名称' })
  @Rule(RuleType['string']().required().error(new ServiceError(ErrorCode.ADMIN_BODY_NICK_NAME)))
  'nick_name': string = undefined;
  @ApiProperty({ description: '账号' })
  @Rule(RuleType['string']().required().error(new ServiceError(ErrorCode.ADMIN_BODY_ACCOUNT)))
  'account': string = undefined;
  @ApiProperty({ description: '密码' })
  @Rule(RuleType['string']().required().error(new ServiceError(ErrorCode.ADMIN_BODY_PASSWORD)))
  'password': string = undefined;
  @ApiProperty({ description: '拥有角色' })
  @Rule(RuleType['array']().empty(''))
  'role': Array<any> = undefined;
  @ApiProperty({ description: '所属部门' })
  @Rule(RuleType['number']().empty(''))
  'dept': number = undefined;
  @ApiProperty({ description: '是否是超级管理员' })
  @Rule(RuleType['string']().empty(''))
  'is_super': string = undefined;
  @ApiProperty({ description: '使用状态' })
  @Rule(RuleType['string']().empty(''))
  'is_use': string = undefined;
}

export class CVO_admin extends FVO_admin {
  constructor(data: object) {
    super(data);
    dealVO(this, data);
  }
}

export class UDTO_admin extends CDTO_admin {
  @ApiProperty({ description: '数据id' })
  @Rule(RuleType['number']().empty(''))
  id: number = undefined;
}

export class UVAO_admin extends FVO_admin {
  constructor(data: object) {
    super(data);
    dealVO(this, data);
  }
}
