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

import { IVariable } from 'app/entities/variable/variable.model';
import { IPeriod } from 'app/entities/period/period.model';
import { IUnit } from 'app/entities/unit/unit.model';
import { IOrganization } from 'app/entities/organization/organization.model';
import { IInputDataUpload } from 'app/entities/input-data-upload/input-data-upload.model';
import { DataSourceType } from 'app/entities/enumerations/data-source-type.model';

export interface IInputData extends IResilientEntity {
  sourceValue?: number | null;
  variableValue?: number | null;
  imputedValue?: number | null;
  stringValue?: string | null;
  sourceType?: keyof typeof DataSourceType | null;
  dataDate?: dayjs.Dayjs | null;
  changeDate?: dayjs.Dayjs | null;
  changeUsername?: string | null;
  dataSource?: string | null;
  dataUser?: string | null;
  dataComments?: string | null;
  creationDate?: dayjs.Dayjs | null;
  creationUsername?: string | null;
  variableClassCode?: string | null;
  variableClassName?: string | null;
  variable?: Pick<IVariable, 'id' | 'name' | 'code'> | null;
  period?: Pick<IPeriod, 'id' | 'name'> | null;
  sourceUnit?: Pick<IUnit, 'id' | 'name'> | null;
  unit?: Pick<IUnit, 'id' | 'name' | 'symbol'> | null;
  owner?: Pick<IOrganization, 'id' | 'name'> | null;
  sourceInputData?: Pick<IInputData, 'id'> | null;
  sourceInputDataUpload?: Pick<IInputDataUpload, 'id'> | null;
}

export type NewInputData = Omit<IInputData, 'id'> & { id: null };

export type SearchInputData = Omit<
								IInputData, 
								// Remove unwanted properties for search
								'id' | 'variable' | 'period' | 'periodVersion' | 'sourceUnit' | 'owner' | 'sourceInputData' | 'sourceInputDataUpload' | 'creationDate' | 'changeDate'>  
								&
								// Add specific properties for search
								{ 
									id?: number | null;
									variableId?: number | null;
									variableNameOrCode?: string | null;
									periodId?: number | null;
									ownerId?: number | null;
									sourceInputDataUploadId?: number | null;
                  variableScopeId?: number | null;
                  variableCategoryId?: number | null;
                  variableClassNameOrCode?: string | null;
								};
