import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {CssStyle} from "../../models/CssStyle";
import {TranslateService} from "@ngx-translate/core";

@Component({
  selector: 'app-css-style',
  templateUrl: './css-style.component.html',
  styleUrls: ['./css-style.component.css']
})
export class CssStyleComponent implements OnInit {
  @Input() style?: CssStyle;
  @Output() styleChange = new EventEmitter<CssStyle>();

  borderStyles:any[] = [];
  constructor(
      private translate: TranslateService
  ) { }

  ngOnInit(): void {
    if (!this.style) {
      this.style = {}
    }

    this.translate.get(["CSS_STYLE.BORDER_STYLE_SOLID", "CSS_STYLE.BORDER_STYLE_DOTTED", "CSS_STYLE.BORDER_STYLE_DASHED", "CSS_STYLE.BORDER_STYLE_NONE"]).subscribe(o => {
      this.borderStyles = [
        {
          id: "none",
          label: o["CSS_STYLE.BORDER_STYLE_NONE"]
        },
        {
          id: "solid",
          label: o["CSS_STYLE.BORDER_STYLE_SOLID"]
        },
        {
          id: "dotted",
          label: o["CSS_STYLE.BORDER_STYLE_DOTTED"]
        },
        {
          id: "dashed",
          label: o["CSS_STYLE.BORDER_STYLE_DASHED"]
        }
      ];
    });
  }
}
