import {
  BaseModel, identifiedBy, observable, computed,
} from '../../model';
import { first, last } from 'lodash';

@identifiedBy('exercise/tag')
export default class ExerciseTag extends BaseModel {

  @observable _tag;
  @observable is_visible = true;

  constructor(tag) {
    super();
    this._tag = tag;
  }

  serialize() {
    return this._tag;
  }

  @computed get name() {
    return this._tag;
  }

  @computed get asString() {
    return this._tag;
  }

  @computed get parts() {
    return this._tag.split(':');
  }

  @computed get type() {
    return first(this.parts);
  }

  @computed get value() {
    return last(this.parts);
  }
}

@@ -334,35 +334,39 @@
     return this.
-_ta
+asStrin
 g;%0A  %7D%0A%0A  @compu
@@ -390,35 +390,39 @@
     return this.
-_ta
+asStrin
 g;%0A  %7D%0A%0A  @compu
@@ -458,24 +458,30 @@
 rn this._tag
+ %7C%7C ''
 ;%0A  %7D%0A%0A  @co
@@ -517,19 +517,23 @@
 rn this.
-_ta
+asStrin
 g.split(

use asString as basis for other getters