import random, string
from datetime import datetime

from api.models import Industry, PCB, City, Station

CATEGORIES = (
    ('Aluminium', 'Aluminium'),
    ('Beverages', 'Beverages'),
    ('Cement', 'Cement'),
    ('CETP', 'CETP'),
    ('Chemical & Pharmaceutical', 'Chemical & Pharmaceutical'),
    ('ChlorAlkali', 'ChlorAlkali'),
    ('Copper', 'Copper'),
    ('Dairy', 'Dairy'),
    ('Distillery', 'Distillery'),
    ('Dye & Dye Intermediates', 'Dye & Dye Intermediates'),
    ('Fertilizer', 'Fertilizer'),
    ('Iron & Steel', 'Iron & Steel'),
    ('Oil Refinery', 'Oil Refinery'),
    ('Pesticide', 'Pesticide'),
    ('Petrochemical', 'Petrochemical'),
    ('Pharmaceuticals', 'Pharmaceuticals'),
    ('Power Plant', 'Power Plant'),
    ('Pulp & Paper', 'Pulp & Paper'),
    ('Slaughter House', 'Slaughter House'),
    ('Sugar', 'Sugar'),
    ('Tannery', 'Tannery'),
    ('Textile', 'Textile'),
    ('Zinc', 'Zinc'),
    ('Chemical', 'Chemical'),
    ('STP', 'STP'),
    ('Coal and Mines', 'Coal and Mines'),
    ('Polymer', 'Polymer'),
    ('Food & Beverages', 'Food & Beverages'),
    ('Food Dairy & Beverages', 'Food Dairy & Beverages'),
    ('Automoblie', 'Automoblie'),
    ('Common Bio Medical Waste Treatment Plant',
     'Common Bio Medical Waste Treatment Plant'),
    ('Engineering', 'Engineering'),
    ('Other', 'Other'),
)
STATES = (
    ('Andhra Pradesh', 'Andhra Pradesh'),
    ('Arunachal Pradesh', 'Arunachal Pradesh'),
    ('Assam', 'Assam'),
    ('Bihar', 'Bihar'),
    ('Chandigarh', 'Chandigarh'),
    ('Chhattisgarh', 'Chhattisgarh'),
    ('Dadra and Nagar Haveli', 'Dadra and Nagar Haveli'),
    ('Delhi', 'Delhi'),
    ('Goa', 'Goa'),
    ('Gujarat', 'Gujarat'),
    ('Haryana', 'Haryana'),
    ('Himachal Pradesh', 'Himachal Pradesh'),
    ('Karnataka', 'Karnataka'),
    ('Kerala', 'Kerala'),
    ('Maharashtra', 'Maharashtra'),
    ('Madhya Pradesh', 'Madhya Pradesh'),
    ('Manipur', 'Manipur'),
    ('Meghalaya', 'Meghalaya'),
    ('Mizoram', 'Mizoram'),
    ('Nagaland', 'Nagaland'),
    ('Odisha', 'Odisha'),
    ('Puducherry', 'Puducherry'),
    ('Punjab', 'Punjab'),
    ('Rajasthan', 'Rajasthan'),
    ('Tamil Nadu', 'Tamil Nadu'),
    ('Telangana', 'Telangana'),
    ('Tripura', 'Tripura'),
    ('Uttar Pradesh', 'Uttar Pradesh'),
    ('Uttarakhand', 'Uttarakhand'),
    ('West Bengal', 'West Bengal'),
)


def randm_zip(st="110"):
    return st + ''.join(random.choices(string.digits, k=3))


def randm_str(k=5):
    return ''.join(random.choices(string.ascii_uppercase + string.digits, k=k))


def randm_status():
    return random.choice(['Live', 'Offline', 'Delay'])


def randm_category():
    return random.choice(CATEGORIES)[0]


def randm_state():
    return random.choice(STATES)[0]


import json
import pandas as pd
from requests.auth import HTTPBasicAuth
import requests

URL = "URL_OF_SERVER"

sess = requests.Session()
def get_header():
    dd = sess.post(
        url=URL + "/api/token/",
        data={"email": "email_id@xyz.com", "password": ""})
    data = json.loads(dd.text)
    access_key = data.get('access')
    header = {
        'Authorization': 'Bearer %s' % access_key
    }
    # data = sess.get(url=URL + "/api/industry/", headers=header)
    # print(pd.DataFrame(json.loads(data.text).get('results')))
    return header


def dummy_industries(session):
    for a in range(4):
        resp = session.post(
            url="%s/api/industry/" % URL,
            headers=get_header(),
            data={
                "name": "Industry_%s" % randm_str(6),
                "industry_code": randm_str(6),
                "status": randm_status(),
                "type": randm_category(),
                "industry_id": randm_str(),
                "address": randm_str(20) + ' ' + randm_state(),
                "zipcode": randm_zip(),
                "user": random.choice(["337a914a-272c-4d91-84a9-9c8a8266dad8",
                                       "ff9c2746-3aa6-4bf3-84c9-effafaac50b3"]),
                "state": randm_state(),
                # "city": 35
            })
        if resp.status_code != 201:
            print(resp.text)


CLOSURE_CHOICES = (
    ('Seasonal', 'Seasonal'),
    ('Plant Shutdown', 'Plant Shutdown'),
    ('Under Maintenance', 'Under Maintenance'),
    ('By CPCB', 'By CPCB')
)
STATE_N_CITY = {
    'Delhi': ['-Select City-', 'Delhi', 'New Delhi'],
    'Karnataka': ['-Select City-', 'Bengaluru', 'Hubli-Dharwad',
                  'Belagavi', 'Mangaluru',
                  'Davanagere', 'Ballari', 'Tumkur', 'Shivamogga',
                  'Raayachuru', 'Robertson Pet', 'Kolar', 'Mandya',
                  'Udupi',
                  'Chikkamagaluru', 'Karwar', 'Ranebennuru',
                  'Ranibennur',
                  'Ramanagaram', 'Gokak', 'Yadgir',
                  'Rabkavi Banhatti',
                  'Shahabad', 'Sirsi', 'Sindhnur', 'Tiptur',
                  'Arsikere',
                  'Nanjangud', 'Sagara', 'Sira', 'Puttur', 'Athni',
                  'Mulbagal',
                  'Surapura', 'Siruguppa', 'Mudhol', 'Sidlaghatta',
                  'Shahpur',
                  'Saundatti-Yellamma', 'Wadi', 'Manvi',
                  'Nelamangala',
                  'Lakshmeshwar', 'Ramdurg', 'Nargund', 'Tarikere',
                  'Malavalli', 'Savanur', 'Lingsugur',
                  'Vijayapura',
                  'Sankeshwara', 'Madikeri', 'Talikota', 'Sedam',
                  'Shikaripur',
                  'Mahalingapura', 'Mudalagi', 'Muddebihal',
                  'Pavagada',
                  'Malur', 'Sindhagi', 'Sanduru', 'Afzalpur',
                  'Maddur',
                  'Madhugiri', 'Tekkalakote', 'Terdal',
                  'Mudabidri', 'Magadi',
                  'Navalgund', 'Shiggaon', 'Shrirangapattana',
                  'Sindagi',
                  'Sakaleshapura', 'Srinivaspur', 'Ron',
                  'Mundargi',
                  'Sadalagi', 'Piriyapatna', 'Adyar'],
    'Gujarat': ['-Select City-', 'Ahmedabad', 'Surat', 'Vadodara',
                'Rajkot', 'Bhavnagar',
                'Jamnagar', 'Nadiad', 'Porbandar', 'Anand',
                'Morvi',
                'Mahesana', 'Bharuch', 'Vapi', 'Navsari',
                'Veraval', 'Bhuj',
                'Godhra', 'Palanpur', 'Valsad', 'Patan', 'Deesa',
                'Amreli',
                'Anjar', 'Dhoraji', 'Khambhat', 'Mahuva', 'Keshod',
                'Wadhwan',
                'Ankleshwar', 'Savarkundla', 'Kadi', 'Visnagar',
                'Upleta',
                'Una', 'Sidhpur', 'Unjha', 'Mangrol', 'Viramgam',
                'Modasa',
                'Palitana', 'Petlad', 'Kapadvanj', 'Sihor',
                'Wankaner',
                'Limbdi', 'Mandvi', 'Thangadh', 'Vyara', 'Padra',
                'Lunawada',
                'Rajpipla', 'Vapi', 'Umreth', 'Sanand', 'Rajula',
                'Radhanpur',
                'Mahemdabad', 'Ranavav', 'Tharad', 'Mansa',
                'Umbergaon',
                'Talaja', 'Vadnagar', 'Manavadar', 'Salaya',
                'Vijapur',
                'Pardi', 'Rapar', 'Songadh', 'Lathi', 'Adalaj',
                'Chhapra'],
    'Madhya Pradesh': ['-Select City-', 'Indore', 'Bhopal', 'Jabalpur',
                       'Gwalior', 'Ujjain', 'Sagar', 'Dewas', 'Satna',
                       'Ratlam', 'Rewa', 'Murwara (Katni)', 'Singrauli',
                       'Burhanpur', 'Khandwa', 'Bhind', 'Chhindwara', 'Guna',
                       'Shivpuri', 'Vidisha', 'Chhatarpur', 'Damoh',
                       'Mandsaur', 'Khargone', 'Neemuch', 'Pithampur',
                       'Hoshangabad', 'Itarsi', 'Sehore', 'Betul', 'Seoni',
                       'Datia', 'Nagda'],
    'Telangana': ['-Select City-', 'Hyderabad', 'Warangal',
                  'Nizamabad', 'Karimnagar',
                  'Ramagundam', 'Khammam', 'Mahbubnagar',
                  'Mancherial',
                  'Adilabad', 'Suryapet', 'Jagtial', 'Miryalaguda',
                  'Nirmal',
                  'Kamareddy', 'Kothagudem', 'Bodhan', 'Palwancha',
                  'Mandamarri', 'Koratla', 'Sircilla', 'Tandur',
                  'Siddipet',
                  'Wanaparthy', 'Kagaznagar', 'Gadwal',
                  'Sangareddy',
                  'Bellampalle', 'Bhongir', 'Vikarabad', 'Jangaon',
                  'Bhadrachalam', 'Bhainsa', 'Farooqnagar',
                  'Medak',
                  'Narayanpet', 'Sadasivpet', 'Yellandu',
                  'Manuguru',
                  'Kyathampalle', 'Nagarkurnool'],
    'Tamil Nadu': ['-Select City-', 'Chennai', 'Coimbatore',
                   'Madurai', 'Tiruchirappalli',
                   'Salem', 'Tirunelveli', 'Tiruppur', 'Ranipet',
                   'Nagercoil',
                   'Thanjavur', 'Vellore', 'Kancheepuram', 'Erode',
                   'Tiruvannamalai', 'Pollachi', 'Rajapalayam',
                   'Sivakasi',
                   'Pudukkottai', 'Neyveli (TS)', 'Nagapattinam',
                   'Viluppuram',
                   'Tiruchengode', 'Vaniyambadi',
                   'Theni Allinagaram',
                   'Udhagamandalam', 'Aruppukkottai', 'Paramakudi',
                   'Arakkonam', 'Virudhachalam', 'Srivilliputhur',
                   'Tindivanam', 'Virudhunagar', 'Karur',
                   'Valparai',
                   'Sankarankovil', 'Tenkasi', 'Palani',
                   'Pattukkottai',
                   'Tirupathur', 'Ramanathapuram',
                   'Udumalaipettai',
                   'Gobichettipalayam', 'Thiruvarur',
                   'Thiruvallur', 'Panruti',
                   'Namakkal', 'Thirumangalam',
                   'Vikramasingapuram',
                   'Nellikuppam', 'Rasipuram', 'Tiruttani',
                   'Nandivaram-Guduvancheri', 'Periyakulam',
                   'Pernampattu',
                   'Vellakoil', 'Sivaganga', 'Vadalur',
                   'Rameshwaram',
                   'Tiruvethipuram', 'Perambalur', 'Usilampatti',
                   'Vedaranyam',
                   'Sathyamangalam', 'Puliyankudi', 'Nanjikottai',
                   'Thuraiyur',
                   'Sirkali', 'Tiruchendur', 'Periyasemur',
                   'Sattur',
                   'Vandavasi', 'Tharamangalam', 'Tirukkoyilur',
                   'Oddanchatram', 'Palladam', 'Vadakkuvalliyur',
                   'Tirukalukundram', 'Uthamapalayam', 'Surandai',
                   'Sankari',
                   'Shenkottai', 'Vadipatti', 'Sholingur',
                   'Tirupathur',
                   'Manachanallur', 'Viswanatham', 'Polur',
                   'Panagudi',
                   'Uthiramerur', 'Thiruthuraipoondi',
                   'Pallapatti', 'Ponneri',
                   'Lalgudi', 'Natham', 'Unnamalaikadai',
                   'P.N.Patti',
                   'Tharangambadi', 'Tittakudi', 'Pacode',
                   "O' Valley",
                   'Suriyampalayam', 'Sholavandan', 'Thammampatti',
                   'Namagiripettai', 'Peravurani', 'Parangipettai',
                   'Pudupattinam', 'Pallikonda', 'Sivagiri',
                   'Punjaipugalur',
                   'Padmanabhapuram', 'Thirupuvanam'],
    'West Bengal': ['-Select City-', 'Kolkata', 'Siliguri',
                    'Asansol', 'Raghunathganj',
                    'Kharagpur', 'Naihati', 'English Bazar',
                    'Baharampur',
                    'Hugli-Chinsurah', 'Raiganj', 'Jalpaiguri',
                    'Santipur',
                    'Balurghat', 'Medinipur', 'Habra', 'Ranaghat',
                    'Bankura',
                    'Nabadwip', 'Darjiling', 'Purulia', 'Arambagh',
                    'Tamluk',
                    'AlipurdUrban Agglomerationr', 'Suri',
                    'Jhargram',
                    'Gangarampur', 'Rampurhat', 'Kalimpong',
                    'Sainthia',
                    'Taki', 'Murshidabad', 'Memari',
                    'Paschim Punropara',
                    'Tarakeswar', 'Sonamukhi',
                    'PandUrban Agglomeration',
                    'Mainaguri', 'Malda', 'Panchla',
                    'Raghunathpur',
                    'Mathabhanga', 'Monoharpur', 'Srirampore',
                    'Adra'],
    'Rajasthan': ['-Select City-', 'Jaipur', 'Jodhpur', 'Bikaner',
                  'Udaipur', 'Ajmer',
                  'Bhilwara', 'Alwar', 'Bharatpur', 'Pali',
                  'Barmer', 'Sikar',
                  'Tonk', 'Sadulpur', 'Sawai Madhopur', 'Nagaur',
                  'Makrana',
                  'Sujangarh', 'Sardarshahar', 'Ladnu',
                  'Ratangarh', 'Nokha',
                  'Nimbahera', 'Suratgarh', 'Rajsamand',
                  'Lachhmangarh',
                  'Rajgarh (Churu)', 'Nasirabad', 'Nohar',
                  'Phalodi',
                  'Nathdwara', 'Pilani', 'Merta City', 'Sojat',
                  'Neem-Ka-Thana', 'Sirohi', 'Pratapgarh',
                  'Rawatbhata',
                  'Sangaria', 'Lalsot', 'Pilibanga', 'Pipar City',
                  'Taranagar',
                  'Sumerpur', 'Sagwara', 'Ramganj Mandi',
                  'Lakheri',
                  'Udaipurwati', 'Losal', 'Sri Madhopur',
                  'Ramngarh',
                  'Rawatsar', 'Rajakhera', 'Shahpura', 'Shahpura',
                  'Raisinghnagar', 'Malpura', 'Nadbai', 'Sanchore',
                  'Nagar',
                  'Rajgarh (Alwar)', 'Sheoganj', 'Sadri',
                  'Todaraisingh',
                  'Todabhim', 'Reengus', 'Rajaldesar',
                  'Sadulshahar',
                  'Sambhar', 'Prantij', 'Mount Abu', 'Mangrol',
                  'Phulera',
                  'Mandawa', 'Pindwara', 'Mandalgarh',
                  'Takhatgarh'],
    'Uttar Pradesh': ['-Select City-', 'Lucknow', 'Kanpur',
                      'Firozabad', 'Agra', 'Meerut',
                      'Varanasi', 'Allahabad', 'Amroha',
                      'Moradabad',
                      'Aligarh', 'Saharanpur', 'Noida', 'Loni',
                      'Jhansi', 'Ghaziabad',
                      'Shahjahanpur', 'Rampur', 'Modinagar',
                      'Hapur', 'Etawah',
                      'Sambhal', 'Orai', 'Bahraich', 'Unnao',
                      'Rae Bareli',
                      'Lakhimpur', 'Sitapur', 'Lalitpur',
                      'Pilibhit',
                      'Chandausi', 'Hardoi', 'Azamgarh', 'Khair',
                      'Sultanpur',
                      'Tanda', 'Nagina', 'Shamli', 'Najibabad',
                      'Shikohabad',
                      'Sikandrabad', 'Pilkhuwa', 'Renukoot',
                      'Vrindavan',
                      'Ujhani', 'Laharpur', 'Tilhar', 'Sahaswan',
                      'Rath',
                      'Sherkot', 'Kalpi', 'Tundla', 'Sandila',
                      'Nanpara',
                      'Sardhana', 'Nehtaur', 'Seohara', 'Padrauna',
                      'Mathura',
                      'Thakurdwara', 'Nawabganj', 'Siana',
                      'Noorpur',
                      'Sikandra Rao', 'Puranpur', 'Rudauli',
                      'Thana Bhawan',
                      'Palia Kalan', 'Zaidpur', 'Nautanwa',
                      'Zamania',
                      'Naugawan Sadat', 'Fatehpur Sikri',
                      'Robertsganj',
                      'Utraula', 'Sadabad', 'Rasra', 'Lar',
                      'Lal Gopalganj Nindaura', 'Sirsaganj',
                      'Pihani',
                      'Rudrapur', 'Soron', 'SUrban Agglomerationr',
                      'Samdhan',
                      'Sahjanwa', 'Rampur Maniharan', 'Sumerpur',
                      'Shahganj',
                      'Tulsipur', 'Tirwaganj',
                      'PurqUrban Agglomerationzi',
                      'Warhapur', 'Powayan', 'Sandi', 'Achhnera',
                      'Naraura',
                      'Nakur', 'Sahaspur', 'Safipur', 'Reoti',
                      'Sikanderpur',
                      'Saidpur', 'Sirsi', 'Purwa', 'Parasi',
                      'Lalganj',
                      'Phulpur', 'Shishgarh', 'Sahawar', 'Samthar',
                      'Pukhrayan', 'Obra', 'Niwai'],
    'Bihar': ['-Select City-', 'Patna', 'Gaya', 'Bhagalpur',
              'Muzaffarpur', 'Darbhanga',
              'Arrah', 'Begusarai', 'Chhapra', 'Katihar', 'Munger',
              'Purnia',
              'Saharsa', 'Sasaram', 'Hajipur', 'Dehri-on-Sone',
              'Bettiah',
              'Motihari', 'Bagaha', 'Siwan', 'Kishanganj',
              'Jamalpur', 'Buxar',
              'Jehanabad', 'Aurangabad', 'Lakhisarai', 'Nawada',
              'Jamui',
              'Sitamarhi', 'Araria', 'Gopalganj', 'Madhubani',
              'Masaurhi',
              'Samastipur', 'Mokameh', 'Supaul', 'Dumraon',
              'Arwal',
              'Forbesganj', 'BhabUrban Agglomeration',
              'Narkatiaganj',
              'Naugachhia', 'Madhepura', 'Sheikhpura',
              'Sultanganj',
              'Raxaul Bazar', 'Ramnagar', 'Mahnar Bazar',
              'Warisaliganj',
              'Revelganj', 'Rajgir', 'Sonepur', 'Sherghati',
              'Sugauli',
              'Makhdumpur', 'Maner', 'Rosera', 'Nokha', 'Piro',
              'Rafiganj',
              'Marhaura', 'Mirganj', 'Lalganj', 'Murliganj',
              'Motipur',
              'Manihari', 'Sheohar', 'Maharajganj', 'Silao',
              'Barh',
              'Asarganj'],
    'Andhra Pradesh': ['-Select City-', 'Visakhapatnam',
                       'Vijayawada', 'Guntur', 'Nellore',
                       'Kurnool', 'Rajahmundry', 'Kakinada',
                       'Tirupati',
                       'Anantapur', 'Kadapa', 'Vizianagaram',
                       'Eluru',
                       'Ongole', 'Nandyal', 'Machilipatnam',
                       'Adoni', 'Tenali',
                       'Chittoor', 'Hindupur', 'Proddatur',
                       'Bhimavaram',
                       'Madanapalle', 'Guntakal', 'Dharmavaram',
                       'Gudivada',
                       'Srikakulam', 'Narasaraopet', 'Rajampet',
                       'Tadpatri',
                       'Tadepalligudem', 'Chilakaluripet',
                       'Yemmiganur',
                       'Kadiri', 'Chirala', 'Anakapalle', 'Kavali',
                       'Palacole',
                       'Sullurpeta', 'Tanuku', 'Rayachoti',
                       'Srikalahasti',
                       'Bapatla', 'Naidupet', 'Nagari', 'Gudur',
                       'Vinukonda',
                       'Narasapuram', 'Nuzvid', 'Markapur',
                       'Ponnur',
                       'Kandukur', 'Bobbili', 'Rayadurg',
                       'Samalkot',
                       'Jaggaiahpet', 'Tuni', 'Amalapuram',
                       'Bheemunipatnam',
                       'Venkatagiri', 'Sattenapalle', 'Pithapuram',
                       'Palasa Kasibugga', 'Parvathipuram',
                       'Macherla',
                       'Gooty', 'Salur', 'Mandapeta',
                       'Jammalamadugu',
                       'Peddapuram', 'Punganur', 'Nidadavole',
                       'Repalle',
                       'Ramachandrapuram', 'Kovvur', 'Tiruvuru',
                       'Uravakonda',
                       'Narsipatnam', 'Yerraguntla', 'Pedana',
                       'Puttur',
                       'Renigunta', 'Rajam',
                       'Srisailam Project (Right Flank Colony) Township'],
    'Punjab': ['-Select City-', 'Ludhiana', 'Patiala', 'Amritsar',
               'Jalandhar', 'Bathinda',
               'Pathankot', 'Hoshiarpur', 'Batala', 'Moga',
               'Malerkotla',
               'Khanna', 'Mohali', 'Barnala', 'Firozpur',
               'Phagwara',
               'Kapurthala', 'Zirakpur', 'Kot Kapura', 'Faridkot',
               'Muktsar',
               'Rajpura', 'Sangrur', 'Fazilka', 'Gurdaspur',
               'Kharar',
               'Gobindgarh', 'Mansa', 'Malout', 'Nabha',
               'Tarn Taran',
               'Jagraon', 'Sunam', 'Dhuri', 'Firozpur Cantt.',
               'Sirhind Fatehgarh Sahib', 'Rupnagar',
               'Jalandhar Cantt.',
               'Samana', 'Nawanshahr', 'Rampura Phul', 'Nangal',
               'Nakodar',
               'Zira', 'Patti', 'Raikot', 'Longowal',
               'Urmar Tanda',
               'Phillaur', 'Pattran', 'Qadian', 'Sujanpur',
               'Mukerian',
               'Talwara'],
    'Haryana': ['-Select City-', 'Faridabad', 'Gurgaon', 'Hisar',
                'Rohtak', 'Panipat', 'Karnal',
                'Sonipat', 'Yamunanagar', 'Panchkula', 'Bhiwani',
                'Bahadurgarh', 'Jind', 'Sirsa', 'Thanesar',
                'Kaithal',
                'Palwal', 'Rewari', 'Hansi', 'Narnaul',
                'Fatehabad', 'Gohana',
                'Tohana', 'Narwana', 'Mandi Dabwali',
                'Charkhi Dadri',
                'Shahbad', 'Pehowa', 'Samalkha', 'Pinjore',
                'Ladwa', 'Sohna',
                'Safidon', 'Taraori', 'Mahendragarh', 'Ratia',
                'Rania',
                'Sarsod'],
    'Chhattisgarh': ['-Select City-', 'Raipur', 'Bhilai Nagar',
                     'Korba', 'Bilaspur', 'Durg',
                     'Rajnandgaon', 'Jagdalpur', 'Raigarh',
                     'Ambikapur',
                     'Mahasamund', 'Dhamtari', 'Chirmiri',
                     'Bhatapara',
                     'Dalli-Rajhara', 'Naila Janjgir',
                     'Tilda Newra',
                     'Mungeli', 'Manendragarh', 'Sakti'],
    'Assam': ['-Select City-', 'Guwahati', 'Silchar', 'Dibrugarh',
              'Nagaon', 'Tinsukia',
              'Jorhat', 'Bongaigaon City', 'Dhubri', 'Diphu',
              'North Lakhimpur', 'Tezpur', 'Karimganj', 'Sibsagar',
              'Goalpara',
              'Barpeta', 'Lanka', 'Lumding', 'Mankachar',
              'Nalbari', 'Rangia',
              'Margherita', 'Mangaldoi', 'Silapathar', 'Mariani',
              'Marigaon'],
    'Chandigarh': ['-Select City-', 'Chandigarh'],
    'Odisha': ['-Select City-', 'Bhubaneswar', 'Cuttack',
               'Raurkela', 'Brahmapur', 'Sambalpur',
               'Puri', 'Baleshwar Town', 'Baripada Town',
               'Bhadrak',
               'Balangir', 'Jharsuguda', 'Bargarh', 'Paradip',
               'Bhawanipatna',
               'Dhenkanal', 'Barbil', 'Kendujhar', 'Sunabeda',
               'Rayagada',
               'Jatani', 'Byasanagar', 'Kendrapara',
               'Rajagangapur',
               'Parlakhemundi', 'Talcher', 'Sundargarh',
               'Phulabani',
               'Pattamundai', 'Titlagarh', 'Nabarangapur', 'Soro',
               'Malkangiri', 'Rairangpur', 'Tarbha'],
    'Kerala': ['-Select City-', 'Thiruvananthapuram', 'Kochi',
               'Kozhikode', 'Kollam',
               'Thrissur', 'Palakkad', 'Alappuzha', 'Malappuram',
               'Ponnani',
               'Vatakara', 'Kanhangad', 'Taliparamba', 'Koyilandy',
               'Neyyattinkara', 'Kayamkulam', 'Nedumangad',
               'Kannur', 'Tirur',
               'Kottayam', 'Kasaragod', 'Kunnamkulam',
               'Ottappalam',
               'Thiruvalla', 'Thodupuzha', 'Chalakudy',
               'Changanassery',
               'Punalur', 'Nilambur', 'Cherthala',
               'Perinthalmanna',
               'Mattannur', 'Shoranur', 'Varkala', 'Paravoor',
               'Pathanamthitta', 'Peringathur', 'Attingal',
               'Kodungallur',
               'Pappinisseri', 'Chittur-Thathamangalam',
               'Muvattupuzha',
               'Adoor', 'Mavelikkara', 'Mavoor', 'Perumbavoor',
               'Vaikom',
               'Palai', 'Panniyannur', 'Guruvayoor', 'Puthuppally',
               'Panamattom'],
    'Uttarakhand': ['-Select City-', 'Dehradun', 'Hardwar',
                    'Haldwani-cum-Kathgodam',
                    'Srinagar', 'Kashipur', 'Roorkee', 'Rudrapur',
                    'Rishikesh',
                    'Ramnagar', 'Pithoragarh', 'Manglaur',
                    'Nainital',
                    'Mussoorie', 'Tehri', 'Pauri', 'Nagla',
                    'Sitarganj',
                    'Bageshwar'],
    'Puducherry': ['-Select City-', 'Pondicherry', 'Karaikal',
                   'Yanam', 'Mahe'],
    'Tripura': ['-Select City-', 'Agartala', 'Udaipur',
                'Dharmanagar', 'Pratapgarh',
                'Kailasahar', 'Belonia', 'Khowai'],
    'Mizoram': ['-Select City-', 'Aizawl', 'Lunglei', 'Saiha'],
    'Meghalaya': ['-Select City-', 'Shillong', 'Tura',
                  'Nongstoin'],
    'Manipur': ['-Select City-', 'Imphal', 'Thoubal', 'Lilong',
                'Mayang Imphal'],
    'Himachal Pradesh': ['-Select City-', 'Shimla', 'Mandi',
                         'Solan', 'Nahan', 'Sundarnagar',
                         'Palampur'],
    'Nagaland': ['-Select City-', 'Dimapur', 'Kohima', 'Zunheboto',
                 'Tuensang', 'Wokha',
                 'Mokokchung'],
    'Goa': ['-Select City-', 'Marmagao', 'Panaji', 'Margao',
            'Mapusa'],
    'Arunachal Pradesh': ['-Select City-', 'Naharlagun',
                          'Pasighat'],
    'Dadra and Nagar Haveli': ['-Select City-', 'Silvassa'],
    'Maharashtra': ['-Select City-',
                    'Ahmadnagar(Ahmednagar)',
                    'Akola',
                    'Amravati',
                    'Aurangabad',
                    'Bhandara',
                    'Bid (Beed)',
                    'Buldana (Buldhana)',
                    'Chandrapur',
                    'Dhule',
                    'Gadchiroli',
                    'Gondiya (Gondia)',
                    'Hingoli',
                    'Jalgaon',
                    'Jalna',
                    'Kolhapur',
                    'Latur',
                    'Mumbai',
                    'Mumbai Suburban',
                    'Nagpur',
                    'Nanded',
                    'Nandurbar',
                    'Nashik',
                    'Osmanabad',
                    'Parbhani',
                    'Pune',
                    'Raigad',
                    'Ratnagiri',
                    'Sangli',
                    'Satara',
                    'Sindhudurg',
                    'Solapur',
                    'Thane',
                    'Wardha',
                    'Washim',
                    'Yavatmal'
                    ]
}
from random import uniform


def dummy_stations():
    industries = Industry.objects.all()
    pcbs = PCB.objects.all()
    for inds in industries:
        for a in range(5):
            city = City.objects.filter(state__name=randm_state())

            cty = random.choice(city)
            if not cty:
                cty = random.choice(city)

            # state = randm_state()
            # city = random.choices(STATE_N_CITY.get(state))
            lng, lat = uniform(-180, 180), uniform(-90, 90)
            Station.objects.create(
                name="stations_%s" % randm_str(4),
                site_id=randm_str(5),
                key=randm_str(20),
                pub_key=randm_str(20),
                pvt_key=randm_str(20),
                realtime_url="",
                delayed_url="",
                prefix=randm_str(5),
                version="ver_1.0",
                address=randm_str(20),  #' ' + (cty.name or ''),
                zipcode=randm_zip(),
                longitude="{0:.6f}".format(lng)[:15],
                latitude="{0:.6f}".format(lat)[:15],
                user_email=randm_str(14) + '@gmail.com',
                user_ph=randm_str(10),
                is_cpcb=True,
                cpcb_email=randm_str(14) + '@gmail.com',
                cpcb_ph=randm_str(10),
                closure_status=random.choices(CLOSURE_CHOICES)[0][0],
                monitoring_type=random.choices(['Effluent', 'Emission', 'CAAQMS']),
                process_attached=random.choices(['Inlet', 'Outlet']),
                ganga=True,
                approval_date=datetime.now().date(),
                amc=datetime.now(),
                cmc=datetime.now(),
                active=True,
                industry=inds,
                pcb=random.choice(pcbs),
                state=cty.state,
                city=cty
            )

# dummy_industries(sess)
# dummy_stations(sess)
