import { Component, OnInit } from '@angular/core';
import {FormBuilder, Validators} from '@angular/forms';
import { BsModalRef } from 'ngx-bootstrap/modal';
import {CookieService} from 'ngx-cookie-service';
import { FrameDetailComponent } from '../../../frame/core/detail/frame.detail';

@Component({
  selector: 'app-weixin-processor-detail',
  templateUrl: './weixin-processor-detail.component.html',
  styleUrls: ['./weixin-processor-detail.component.scss']
})
export class WeixinProcessorDetailComponent extends FrameDetailComponent implements OnInit {

  constructor(bsModalRef: BsModalRef, fb: FormBuilder, private cookies: CookieService) {
    super(bsModalRef);
    this.detailForm = fb.group({
      'process_class': [null, Validators.compose([Validators.required, Validators.minLength(12), Validators.maxLength(128)])],
      'process_param': [null],
      'msg_type': [null, Validators.required],
      'run_thread': [null, Validators.required],
      'process_desc': [null]
    });
  }
  initDefautEntity() {
    if (this.detailMode === 'add') {
      this.currentEntity.wx_id = this.cookies.get('CurrentWxId');
      this.currentEntity.run_thread = 'Active';
    }
  }


  ngOnInit() {
  }

}
