src/helpers/Status.js
import StatusModel from '../models/Status';
import Helper from './Helper';
import { aggregate } from '../utilities/ClassUtility';
/**
* Helper class representing an status.
*
* @extends {StatusModel}
* @extends {Helper}
*
* @example
* import { Status, clinical6 } from 'clinical6';
*
* // Typically use clinical6.get(Status)
* clinical6.get(Status).then(statuss => console.log(statuss));
*
* const status = new Status({
* data: {
* id: '15',
* type: 'statuses',
* attributes: {
* status_id: '922176',
* name: 'Frankie Hermann',
* email: 'lisa@kulas.info',
* phone_number: null,
* fax_number: null
* },
* relationships: {
* contact: {
* data: null
* },
* owner: {
* data: {
* id: '98',
* type: 'owners'
* }
* },
* agreement_templates: {
* data: []
* }
* }
* }
* });
*/
class Status extends aggregate(StatusModel, Helper) {
/**
* Constructor for helper class representing an Status
*
* @param {Object} json - json api response from server
*/
constructor(json = {}) {
super(json);
this.deserializeRelationshipStubs(json);
this.syncRelationships(json);
}
/** @type {String} - The type */
static get type() {
return 'statuses';
}
/** @type {Owner} */
get owner() {
return this._relationships.owner;
}
/** @type {Owner} */
set owner(owner) {
/** @type {Owner} */
this._relationships.owner = owner;
}
/** @type {Helper} */
get statusable() {
return this._relationships.statusable;
}
/** @type {Helper} */
set statusable(statusable) {
/** @type {Helper} */
this._relationships.statusable = statusable;
}
}
export default Status;