function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

import React, { Component } from "react";
import { StyleSheet, View, Text, TouchableOpacity, Image, Button, LogBox, TextInput, StatusBar, FlatList } from "react-native";
import Icon from 'react-native-vector-icons/FontAwesome';
import Colors from './Colors';
import { INSTRUCTIONS_URL, SELFSURVEYSERVICE_DOCUMENT_URL, AGENT_DATA } from '../Api/ApiUrls';
import { PAN_CARD, POLICE_FIR, EXTERNAL_DAMAGE, INTERNAL_DAMAGE, RC_BOOK, AADHAR_CARD, CNG, DRIVING_LICENSE, VIDEO_TITLE, SELFI_IMAGE, ODOMETER, VIDEO_URL, PRIVATE_CAR_20103, PRIVATE_CAR_20102, PRIVATE_CAR_20101, BIKE_20202, BIKE_20201, CUMMERCIAL_20302, CUMMERCIAL_20301, SCREEN_HEIGHT, SCREEN_WIDTH } from './Constants';
import { getSurveyInstructions } from './Services/surveyInstructions';
import { ANDROID_REQUEST, WEB_REQUEST } from './Constants';
import { SURVEY_INSTRUCTIONS } from '../Api/ApiUrls';
export default class QuoteInstructions extends Component {
  constructor(props) {
    super(props);

    _defineProperty(this, "renderItem", ({
      item
    }) => {
      return /*#__PURE__*/React.createElement(Text, {
        style: styles.instructionText
      }, '\u2022' + " ", " ", item.instructionData);
    });

    _defineProperty(this, "renderListHeader", () => {
      const {
        description
      } = this.state.instuctionData;
      return /*#__PURE__*/React.createElement(View, {
        style: {
          marginLeft: 16,
          marginBottom: 16
        }
      }, /*#__PURE__*/React.createElement(Text, {
        style: {
          fontFamily: 'Muli-Regular',
          fontSize: 16
        }
      }, description));
    });

    _defineProperty(this, "renderListFotter", () => {
      return /*#__PURE__*/React.createElement(View, {
        style: {
          flexDirection: 'row'
        }
      }, /*#__PURE__*/React.createElement(View, {
        style: {
          flex: 0.9,
          marginLeft: 16,
          backgroundColor: '#F5F5F5'
        }
      }, /*#__PURE__*/React.createElement(Text, {
        style: {
          fontFamily: 'Muli-Regular',
          fontSize: 16,
          marginTop: 16,
          marginLeft: 16
        }
      }, "We need the following permission before you start clicking the images."), /*#__PURE__*/React.createElement(Text, {
        style: {
          fontFamily: 'Muli-Regular',
          fontSize: 16,
          marginLeft: 16
        }
      }, '\u2022', " Camera"), /*#__PURE__*/React.createElement(Text, {
        style: {
          fontFamily: 'Muli-Regular',
          fontSize: 16,
          marginLeft: 16
        }
      }, '\u2022', " Location"), /*#__PURE__*/React.createElement(Text, {
        style: {
          fontFamily: 'Muli-Regular',
          fontSize: 16,
          marginLeft: 16
        }
      }, '\u2022', " Gallery"), /*#__PURE__*/React.createElement(Text, {
        style: {
          fontFamily: 'Muli-Regular',
          fontSize: 16,
          marginBottom: 16,
          marginLeft: 16
        }
      }, "Don't warry - we wan't peep into your phone's data!")));
    });

    this.state = {
      instuctionData: "",
      surveyInstructions: ""
    };
  }

  componentDidMount() {
    this.surveyInstructions();
  }

  async surveyInstructions() {
    // this.instructionWebOrAndroid()
    const activityTypeId = this.props.screenProps.activityTypeId;
    let updatedActivityId = this.getActivityTypeIdIfSSL(activityTypeId);
    let requestType = updatedActivityId == 6 || updatedActivityId == 7 || updatedActivityId == 8 || updatedActivityId == 9 || updatedActivityId == 10 || updatedActivityId == 11 || updatedActivityId == 15 || updatedActivityId == 31 ? WEB_REQUEST : ANDROID_REQUEST;
    let typeNumber;

    if (requestType = WEB_REQUEST) {
      typeNumber = 1;
    } else {
      typeNumber = 0;
    }

    let uri = SURVEY_INSTRUCTIONS + updatedActivityId + "?" + WEB_REQUEST + typeNumber; //for geting Survey instructions

    getSurveyInstructions({
      uri: uri
    }).then(instuctionData => {
      //sorting the instruction on basis of surveyInstructionsId
      let surveyInstructions = instuctionData.TSurveyInstructions.sort((a, b) => a.surveyInstructionsId > b.surveyInstructionsId);
      this.setState({
        instuctionData: instuctionData,
        surveyInstructions: surveyInstructions
      }); //   console.log('Survey instructions '+JSON.stringify(surveyInstructions));
    });
  }

  getActivityTypeIdIfSSL(activityTypeId) {
    if (activityTypeId == 50) {
      // Used for SSL deeplink / mapping given by Gowtham
      activityTypeId = 5;
    } else if (activityTypeId == 49) {
      activityTypeId = 26;
    } else if (activityTypeId == 51) {
      activityTypeId = 30;
    }

    return activityTypeId;
  } //flatList


  render() {
    const {
      title,
      description
    } = this.state.instuctionData;
    const {
      surveyInstructions
    } = this.state.surveyInstructions;
    const activityTypeId = this.props.screenProps.activityTypeId;
    return /*#__PURE__*/React.createElement(View, {
      style: {
        flex: 1,
        backgroundColor: '#FFFFFF'
      }
    }, /*#__PURE__*/React.createElement(StatusBar, {
      hidden: true
    }), /*#__PURE__*/React.createElement(View, {
      style: {
        flex: 0.9
      }
    }, /*#__PURE__*/React.createElement(View, {
      style: {
        width: SCREEN_WIDTH,
        height: 70,
        backgroundColor: '#F5F5F5',
        justifyContent: 'center',
        marginBottom: 16
      }
    }, /*#__PURE__*/React.createElement(View, {
      style: {
        flexDirection: 'row'
      }
    }, /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(TouchableOpacity, {
      onPress: () => this.props.navigation.navigate("PI")
    }, /*#__PURE__*/React.createElement(Icon, {
      name: "arrow-left",
      size: 25,
      style: {
        marginLeft: 16,
        marginRight: 16
      }
    }))), /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Text, {
      style: {
        fontFamily: 'Muli-Bold',
        fontSize: 20,
        marginLeft: 16
      }
    }, title)))), /*#__PURE__*/React.createElement(View, {
      style: {
        flex: 1
      }
    }, /*#__PURE__*/React.createElement(FlatList, {
      data: this.state.surveyInstructions,
      renderItem: this.renderItem,
      ListHeaderComponent: this.renderListHeader,
      ListFooterComponent: this.renderListFotter,
      style: {
        fontFamily: 'Mulli-Regular'
      }
    }))), /*#__PURE__*/React.createElement(View, {
      style: {
        flex: 0.1,
        justifyContent: 'flex-end',
        marginBottom: 8
      }
    }, /*#__PURE__*/React.createElement(View, {
      style: {
        marginLeft: 16
      }
    }, /*#__PURE__*/React.createElement(TouchableOpacity, null, /*#__PURE__*/React.createElement(View, {
      style: styles.captureImageButtonView
    }, /*#__PURE__*/React.createElement(Text, {
      style: styles.captureImageButtonText
    }, "Let's Get Started"))))));
  }

}
const styles = StyleSheet.create({
  main: {
    flex: 1 // backgroundColor: Colors.white,

  },
  captureImageButtonView: {
    height: 48,
    borderRadius: 4,
    backgroundColor: Colors.digitYellow,
    marginTop: 2,
    flexDirection: 'row',
    justifyContent: 'center',
    marginRight: 16
  },
  captureImageButtonText: {
    fontSize: 16,
    fontFamily: 'Muli-Black',
    alignSelf: 'center'
  },
  instructionText: {
    fontFamily: 'Muli_Regular',
    fontSize: 16,
    marginBottom: 8,
    marginLeft: 16
  }
});
//# sourceMappingURL=QuoteInstructions.js.map