import { v4 as uuidv4 } from 'uuid' ; import { Dimension , Image , ImageState , ImageUpdate , ImageVideo , } from '@dark-rush-photography/shared/types' ; export const loadNewImage = ( entityId , slug , order ) : Image => ( { id : uuidv4 ( ) , entityId , storageId : uuidv4 ( ) , slug , order , state : ImageState . New , isStarred : false , isLoved : false , } ) ; export const loadAddImagePostImage = ( entityId , slug ) : Image => ( { id : uuidv4 ( ) , entityId , storageId : uuidv4 ( ) , slug , order : 0 , state : ImageState . Selected , isStarred : false , isLoved : false , } ) ; export const loadAddTestImage = ( entityId , slug ) : Image => ( { id : uuidv4 ( ) , entityId , storageId : uuidv4 ( ) , slug , order : 0 , state : ImageState . New , isStarred : false , isLoved : false , } ) ; export const loadUpdateImage = ( image , imageUpdate ) : Image => ( { id : image . id , entityId : image . entityId , storageId : image . storageId , slug : image . slug , order : image . order , state : image . state , threeSixtyImageStorageId : imageUpdate . threeSixtyImageStorageId , isStarred : imageUpdate . isStarred , isLoved : imageUpdate . isLoved , title : imageUpdate . title , createdDate : image . createdDate , seoDescription : imageUpdate . seoDescription , seoKeywords : imageUpdate . seoKeywords . join ( ',' ) , smallDimension : image . smallDimension , } ) ; export const loadUpdateImageOrder = ( image , order ) : Image => ( { id : image . id , entityId : image . entityId , storageId : image . storageId , slug : image . slug , order , state : image . state , threeSixtyImageStorageId : image . threeSixtyImageStorageId , isStarred : image . isStarred , isLoved : image . isLoved , title : image . title , createdDate : image . createdDate , seoDescription : image . seoDescription , seoKeywords : image . seoKeywords , smallDimension : image . smallDimension , } ) ; export const loadUpdateImageState = ( image , state ) : Image => ( { id : image . id , entityId : image . entityId , storageId : image . storageId , slug : image . slug , order : image . order , state , threeSixtyImageStorageId : image . threeSixtyImageStorageId , isStarred : image . isStarred , isLoved : image . isLoved , title : image . title , createdDate : image . createdDate , seoDescription : image . seoDescription , seoKeywords : image . seoKeywords , smallDimension : image . smallDimension , } ) ; export const loadUpdateImageCreatedDate = ( image , createdDate ) : Image => ( { id : image . id , entityId : image . entityId , storageId : image . storageId , slug : image . slug , order : image . order , state : image . state , threeSixtyImageStorageId : image . threeSixtyImageStorageId , isStarred : image . isStarred , isLoved : image . isLoved , title : image . title , createdDate , seoDescription : image . seoDescription , seoKeywords : image . seoKeywords , smallDimension : image . smallDimension , } ) ; export const loadUpdateImageSmallDimension = ( image , smallDimension ) : Image => ( { id : image . id , entityId : image . entityId , storageId : image . storageId , slug : image . slug , order : image . order , state : image . state , threeSixtyImageStorageId : image . threeSixtyImageStorageId , isStarred : image . isStarred , isLoved : image . isLoved , title : image . title , createdDate : image . createdDate , seoDescription : image . seoDescription , seoKeywords : image . seoKeywords , smallDimension , } ) ; export const loadAddImageVideo = ( slug ) : ImageVideo => ( { storageId : uuidv4 ( ) , slug , } ) ;