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

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

  ngOnInit() {
  }

}
