import type {
  TruckLaneMoveTargetRequest,
  TruckLaneScheduleLineRequest,
} from "@/app/api/shop/actions";

export function moveToScheduleLine(
  move: TruckLaneMoveTargetRequest,
): TruckLaneScheduleLineRequest {
  return {
    action: "MOVE",
    truckRowId: move.truckRowId,
    toTruckLanceCode: move.toTruckLanceCode,
    toRemark: move.toRemark ?? null,
    toStoreId: move.toStoreId,
    toLoadingSequence: move.toLoadingSequence,
    toDistrictReference: move.toDistrictReference ?? null,
  };
}

export function movesToScheduleLines(
  moves: TruckLaneMoveTargetRequest[],
): TruckLaneScheduleLineRequest[] {
  return moves.map(moveToScheduleLine);
}
