import {Widget} from '@bthlabs/homehub-components';
import {API, BaseService} from '@bthlabs/homehub-core';
import React from 'react';

export const VendorTestWidget = (props) => {
  return (
    <Widget {...props}>
      <p>Hello, <strong>VendorTestWidget!</strong></p>
    </Widget>
  );
};

VendorTestWidget.defaultLayout = {
  h: 2,
  w: 2
};
VendorTestWidget.layoutConstraints = {
  minH: 2,
  minW: 2
};
VendorTestWidget.title = 'Vendor Test';

export class VendorTestService extends BaseService {
  static kind = 'VendorTestService';
  static widget = 'VendorTestWidget';
  async start () {
    const result = await API.Services.start(
      VendorTestService.kind, this.instance, this.characteristics
    );

    this.notify(result.data);
  }
  async stop () {
    return API.Services.stop(VendorTestService.kind, this.instance);
  }
}
