hunk.code_window:                     for (final ApplicationPage page : pages) {
                           if (pageId.equals(page.getId())) {
                               foundPage = page;
                           }
                       }
                       //Set the order for the pages which has null values. At present we dont store the order and hence we need to update the values
                       for (int i = 1; i <= pages.size(); i++) {
                           ApplicationPage page = pages.get(i - 1);
                           if (page.getOrder() == null) {
                               page.setOrder(i);
                           }
                       }
                       /* there are two cases where page is re-ordered. Lets assume there are five pages 1,2,3,4,5
                        * Case 1(isMovingUp == true): p5 to p2, order of p2,p3,p4 increases by 1.
                        *
                        * Case 2(isMovingUp == false): p2 to p5, order of p3,p4,p5 decreases by 1.
  
hunk.labels: keep keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
hunk.file_path: app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationPageServiceImpl.java
hunk.type: replace
file: import React from "react";
  import BaseControl, { ControlProps } from "./BaseControl";
  import { StyledSwitch } from "./StyledControls";
  import { ControlType } from "constants/PropertyControlConstants";
  import FormLabel from "components/editorComponents/FormLabel";
  import { Field, WrappedFieldProps } from "redux-form";
  import styled from "styled-components";
  
  type Props = WrappedFieldProps & {
    label: string;
    isRequired: boolean;
    info: string;
  };
  
  const StyledFormLabel = styled(FormLabel)`
    margin-bottom: 0px;
  `;
  
  const SwitchWrapped = styled.div`
    flex-direction: row;
    display: flex;
    align-items: center;
    .bp3-control {
      margin-bottom: 0px;
    }
  `;
  
  const Info = styled.div`
    font-size: 12px;
    opacity: 0.7;
    margin-top: 8px;
  `;
  
  export class SwitchField extends React.Component<Props, any> {
    get value() {
      const { input } = this.props;
      if (typeof input.value !== "string") return !!input.value;
      else {
        if (input.value.toLocaleLowerCase() === "false") return false;
        else return !!input.value;
      }
    }
  
    render() {
      const { info, input, isRequired, label } = this.props;
  
      return (
        <div>
          <SwitchWrapped data-cy={this.props.input.name}>
            <StyledFormLabel>
              {label} {isRequired && "*"}
            </StyledFormLabel>
            <StyledSwitch
              checked={this.value}
              large
              onChange={(value) => input.onChange(value)}
            />
          </SwitchWrapped>
          {info && <Info>{info}</Info>}
        </div>
      );
    }
  }
  
  class SwitchControl extends BaseControl<SwitchControlProps> {
    render() {
      const { configProperty, info, isRequired, label } = this.props;
  
      return (
        <Field
          component={SwitchField}
          info={info}
          isRequired={isRequired}
          label={label}
          name={configProperty}
        />
      );
    }
  
    getControlType(): ControlType {
      return "SWITCH";
    }
  }
  
  export interface SwitchControlProps extends ControlProps {
    info?: string;
  }
  
  export default SwitchControl;
  