import { IResilientEntity } from 'app/resilient/resilient-base/resilient-base.model';

import { IUnit } from 'app/entities/unit/unit.model';
import { IVariableScope } from 'app/entities/variable-scope/variable-scope.model';
import { IVariableCategory } from 'app/entities/variable-category/variable-category.model';
import { IVariableClassType } from 'app/entities/variable-class-type/variable-class-type.model';
import { IVariableUnits } from 'app/entities/variable-units/variable-units.model';
import { InputMode } from 'app/entities/enumerations/input-mode.model';
import { IOrganization } from 'app/entities/organization/organization.model';

export interface IVariable extends IResilientEntity {
  code?: string | null;
  variableIndex?: number | null;
  name?: string | null;
  description?: string | null;
  input?: boolean | null;
  inputMode?: keyof typeof InputMode | null;
  output?: boolean | null;
  outputSingle?: boolean | null;
  outputOwner?: IOrganization | null;
  outputFormula?: string | null;
  valueScale?: number | null;
  baseUnit?: Pick<IUnit, 'id' | 'name' | 'unitType'> | null;
  variableScope?: Pick<IVariableScope, 'id' | 'name'> | null;
  variableCategory?: Pick<IVariableCategory, 'id' | 'name'> | null;
  variableClassType?: Pick<IVariableClassType, 'id' | 'name'> | null;
  variableClassMandatory?: boolean | null;
  variableClassLabel?: string | null;
  variableUnits?: IVariableUnits[] | null;
  hiddenForMain?: boolean | null;
}

export type NewVariable = Omit<IVariable, 'id'> & { id: null };

export type SearchVariable = Omit<
								  IVariable, 
								  // Remove unwanted properties in search
								  'id' | 'variableUnits' | 'variableClassType' | 'variableCategory' | 'variableScope' | 'outputOwner'> 
								  &
								  // Add specific properties for search
								  { 
									id?: number | null;
									variableScopeId?: number | null;
									variableCategoryId?: number | null;
									variableClassTypeId?: number | null;
								  };

