import { DEVICE_OPTIONS, GEO_ACTION_INCLUDE, PACING_HOURLY_EVEN, STATUS_PLANNED } from '../constants';

const addDay = (day) => day * 24 * 60 * 60 * 1000;
const addHour = (hour) => hour * (60 * 60 * 1000);

function createDefaultRow() {
  const startDateTime = new Date(new Date().getTime() + addDay(1) + addHour(1)).getTime(); // + 1 day and 1 hour

  const endDateShift = +process.env.APP_VIDEO_TARGETING_END_DATE_SHIFT;

  const endDateTime = new Date(startDateTime + addDay(endDateShift)).getTime(); // + endDateShift days

  return {
    id: `${Math.random()}-${Math.random()}`,
    startDateTime,
    endDateTime,
    status: STATUS_PLANNED,
    device: DEVICE_OPTIONS,
    geo: [],
    geoAction: GEO_ACTION_INCLUDE,
    viewsBudget: 1000,
    viewsDelivered: 0,
    pacing: PACING_HOURLY_EVEN,
  };
}

export default createDefaultRow;
