"""Generate Customer Data"""

import csv
import random

from config import MIN_CUSTOMER_ID, MAX_CUSTOMER_ID

ACQUISITION_SOURCES = [
    'OrganicSearch',
    'PaidSearch',
    'Email',
    'SocialMedia',
    'Display',
    'Affiliate'
    'Referral'
]


def main():
    with open('customers.csv', 'w') as fout:
        writer = csv.DictWriter(fout, fieldnames=['CustomerID', 'AcquisitionSource'])
        writer.writeheader()
        for customer_id in range(MIN_CUSTOMER_ID, MAX_CUSTOMER_ID + 1):
            record = {
                'CustomerID': int(customer_id),
                'AcquisitionSource': random.choices(ACQUISITION_SOURCES).pop()
            }
            writer.writerow(record)


if __name__ == '__main__':
    main()

[((328, 396), 'csv.DictWriter', 'csv.DictWriter', (['fout'], {'fieldnames': "['CustomerID', 'AcquisitionSource']"}), "(fout, fieldnames=['CustomerID', 'AcquisitionSource'])\n", (342, 396), False, 'import csv\n'), ((606, 641), 'random.choices', 'random.choices', (['ACQUISITION_SOURCES'], {}), '(ACQUISITION_SOURCES)\n', (620, 641), False, 'import random\n')]