import {Injectable} from '@angular/core';
import {Resource, Service} from 'ngx-jsonapi';

@Injectable()
export class AppsService extends Service<App> {

  public resource = App;
  public type = 'apps';
}

export class App extends Resource {
  public attributes: {
    sdk: string,
    version: string,
    package: string,
    key: string,
    name: string,
  };

  get sdk() {
    return this.attributes.sdk;
  }

  set sdk(sdk: string) {
    this.attributes.sdk = sdk;
  }

  get version() {
    return this.attributes.version;
  }

  set version(version: string) {
    this.attributes.version = version;
  }

  get package() {
    return this.attributes.package;
  }

  set package(p: string) {
    this.attributes.package = p;
  }

  get key() {
    return this.attributes.key;
  }

  set key(key: string) {
    this.attributes.key = key;
  }

  get name() {
    return this.attributes.key;
  }

  set name(name: string) {
    this.attributes.name = name;
  }
}
