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

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

  constructor(bsModalRef: BsModalRef, fb: FormBuilder, private cookies: CookieService) {
    super(bsModalRef);
    this.valForm = 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.editModel === 'add') {
      this.currentEntity.wx_id = this.cookies.get('CurrentWxId');
      this.currentEntity.run_thread = 'Active';
    }
  }


  ngOnInit() {
  }

}
