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-reply-detail',
  templateUrl: './weixin-reply-detail.component.html',
  styleUrls: ['./weixin-reply-detail.component.scss']
})
export class WeixinReplyDetailComponent extends FrameEditComponent implements OnInit {

  constructor(bsModalRef: BsModalRef, fb: FormBuilder, private cookies: CookieService) {
    super(bsModalRef);
    this.valForm = fb.group({
      'msg_name': [null, Validators.compose([Validators.required, Validators.minLength(12), Validators.maxLength(128)])],
      'msg_content': [null, Validators.compose([Validators.required, Validators.minLength(12), Validators.maxLength(1024)])]
    });
  }
  initDefautEntity() {
    if (this.editModel === 'add') {
      this.currentEntity.wx_id = this.cookies.get('CurrentWxId');
    }
  }

  ngOnInit() {
  }

}
