import { createAction, props } from '@ngrx/store';
import { StrictHttpResponse, ResponseArgsOfIEnumerableOfFileDTO } from '@swagger/eis';
import { FileDTO } from './defs';

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

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

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

export const getFilesResponse = createAction(
  `${prefix} Get Files Response`,
  props<{ taskId: number; response: StrictHttpResponse<ResponseArgsOfIEnumerableOfFileDTO> }>()
);

export const getImageTeaserFilesRequest = createAction(`${prefix} Get Image Teaser Files Request`, props<{ taskId: number }>());

export const getImageTeaserFilesResponse = createAction(
  `${prefix} Get Image Teaser Files Response`,
  props<{ taskId: number; response: StrictHttpResponse<ResponseArgsOfIEnumerableOfFileDTO> }>()
);

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

export const getImageFilesResponse = createAction(
  `${prefix} Get Image Files Response`,
  props<{ taskId: number; response: StrictHttpResponse<ResponseArgsOfIEnumerableOfFileDTO> }>()
);

export const getConfiramtionImageFileRequest = createAction(`${prefix} Get Confirmation Image File Request`, props<{ taskId: number }>());

export const getConfiramtionImageFileResponse = createAction(
  `${prefix} Get Confirmation Image File Response`,
  props<{ taskId: number; response: StrictHttpResponse<ResponseArgsOfIEnumerableOfFileDTO> }>()
);

export const addFiles = createAction(`${prefix} Set Files`, props<{ files: FileDTO[] }>());

export const clear = createAction(`${prefix} Clear`, props<{ taskId: number; section: 'file' | 'image' | 'teaser' | 'confirmation' }>());

export const clearAll = createAction(`${prefix} Clear All`);
