import { IPermissionsModel } from '@fleio-api/base-model/IPermissionsModel';
import { IIcon } from '@shared/ui/common/interfaces/icon';
import { ITitle } from '@objects-view/interfaces/card-data/card-title';
import { IObjectStatus, StatusType, StatusValue } from '@objects-view/interfaces/object-status';
import { ObjectUIServiceBase } from '@objects-view/object-ui-service-base';
import { IAction } from '@objects-view/interfaces/actions/action';
import { IDataField } from '@objects-view/interfaces/card-data/data-field';
import { IDetailsTab } from '@objects-view/interfaces/details/details-tab';
import { IActivityLogModel } from '@fleio-api/utils/model/activity-log.model';


export class ActivityLogUIService extends ObjectUIServiceBase<IActivityLogModel> {

  constructor(
    iActivityLogModel: IActivityLogModel, permissions: IPermissionsModel, state: string,
  ) {
    super(iActivityLogModel, permissions, state);
  }

  getIcon(): IIcon {
    return null;
  }

  getStatus(): IObjectStatus {
    switch (this.object.state) {
      case 'success':
        return {type: StatusType.Defined, value: StatusValue.Success};
      case 'error':
        return {type: StatusType.Defined, value: StatusValue.Error};
      case 'pending':
        return {type: StatusType.Changing, value: StatusValue.Pending};
      default:
        return {type: StatusType.Defined, value: StatusValue.Undefined};
    }
  }

  getTitle(): ITitle {
    switch (this.state) {
      default:
        return {
          text: `${this.object.log}`,
          subText: $localize`${this.object.tasks_count} tasks`,
        };
    }
  }

  getActions(): IAction[] {
    const actions: IAction[] = [];

    return actions;
  }

  getDetailsActions(): IAction[] {
    const actions = [];

    return actions;
  }

  getDetailsLink(): string {
    return null;
  }

  getCardFields(): IDataField[] {
    const fields = [];

    return fields;
  }

  getTabs(): IDetailsTab[] {
    return [];
  }

  getCardTags(): string[] {
    const tags = [];

    return tags;
  }
}
