import { createAction, props } from '@ngrx/store';
import {
  StrictHttpResponse,
  DisplayInfoDTO,
  ResponseArgsOfIEnumerableOfDisplayInfoDTO,
  DisplayInfoRequest,
  ResponseArgsOfEntityDTOContainerOfBranchDTO,
  FileDTO,
  ResponseArgsOfConfirmationDTO,
  ResponseArgs,
} from '@swagger/eis';

const prefix = '[Branch] [Task Calendar]';

export const getCurrentBranchRequest = createAction(`${prefix}  Get Current Branch Request`);

export const getCurrentBranchResponse = createAction(
  `${prefix} Get Current Branch Response`,
  props<{
    response: StrictHttpResponse<ResponseArgsOfEntityDTOContainerOfBranchDTO>;
  }>()
);

export const getTasksRequest = createAction(`${prefix}  Get Tasks Request`);

export const getTasksResponse = createAction(
  `${prefix} Get Tasks Response`,
  props<{
    response: StrictHttpResponse<ResponseArgsOfIEnumerableOfDisplayInfoDTO>;
  }>()
);

export const getTaskRequest = createAction(`${prefix}  Get Tasks Request`, props<{ taskId: number }>());

export const getTaskResponse = createAction(`${prefix}  Get Tasks Response`, props<{ response: StrictHttpResponse<DisplayInfoDTO> }>());

export const patchTaskRequest = createAction(`${prefix} Patch Task Request`);

export const patchTaskResponse = createAction(`${prefix} Patch Task Response`);

export const setTasks = createAction(`${prefix} Set Tasks`, props<{ tasks: DisplayInfoDTO[] }>());

export const setTask = createAction(`${prefix} Set Task`, props<{ task: DisplayInfoDTO }>());

export const setFilter = createAction(`${prefix} Set Filter`, props<{ filter: DisplayInfoRequest }>());

export const patchFilter = createAction(`${prefix} Patch Filter`, props<{ filter: Partial<DisplayInfoRequest> }>());

export const openTaskDialog = createAction(`${prefix} Open Task Dialog`, props<{ taskId: number }>());

export const patchTask = createAction(`${prefix} Patch Task`, props<{ taskId: number; changes: Partial<DisplayInfoDTO> }>());

export const patchTaskStatus = createAction(
  `${prefix} Patch Task Status Request`,
  props<{ taskId: number; state: 'edit' | 'reset' | 'complete'; file?: FileDTO }>()
);

export const patchTaskEditRequest = createAction(`${prefix} Patch Task Edit Request`, props<{ taskId: number }>());

export const patchTaskEditResponse = createAction(
  `${prefix} Patch Task Edit Response`,
  props<{ response: StrictHttpResponse<ResponseArgsOfConfirmationDTO> }>()
);

export const patchTaskResetRequest = createAction(`${prefix} Patch Task Reset Request`, props<{ taskId: number }>());

export const patchTaskResetResponse = createAction(
  `${prefix} Patch Task Reset Response`,
  props<{ response: StrictHttpResponse<ResponseArgsOfConfirmationDTO> }>()
);

export const patchTaskCompleteRequest = createAction(`${prefix} Patch Task Complete Request`, props<{ taskId: number; file?: FileDTO }>());

export const patchTaskCompleteResponse = createAction(
  `${prefix} Patch Task Complete Response`,
  props<{ taskId: number; response: StrictHttpResponse<ResponseArgs> }>()
);
