import { Model } from 'objection';
import { BaseModel } from './base.model';
import { Workflow } from './workflow.model';

export class WorkflowState extends BaseModel {
  static tableName = 'workflow_states';

  requestId: string;
  workflowId: string;
  state: any;

  static relationMappings = {
    workflow: {
      relation: Model.BelongsToOneRelation,
      modelClass: Workflow,
      join: {
        from: 'workflow_states.workflowId',
        to: 'workflows.id',
      },
    },
  };
}
