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

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

  ngOnInit() {
  }

}
