from .models import db
from .models import Post, User, Schedule, Comment
import datetime


def seed():
    # テーブルのデータを消去
    db.session.query(User).delete()
    db.session.query(Post).delete()
    db.session.query(Schedule).delete()
    db.session.query(Comment).delete()

    user_list = [
        User(
            user_name='tomo',
            e_mail='test1@example.com',
            password='93329c60badb9d8252ad6c9d5f0c07f1848948bc5bd4b42ad9301a90639e8880'),
        User(
            user_name='saku',
            e_mail='test2@example.com',
            password='93329c60badb9d8252ad6c9d5f0c07f1848948bc5bd4b42ad9301a90639e8880'),
        User(
            user_name='toyo',
            e_mail='test3@example.com',
            password='93329c60badb9d8252ad6c9d5f0c07f1848948bc5bd4b42ad9301a90639e8880'),
        User(
            user_name='mari',
            e_mail='test4@example.com',
            password='93329c60badb9d8252ad6c9d5f0c07f1848948bc5bd4b42ad9301a90639e8880'),
        User(
            user_name='shin',
            e_mail='test5@example.com',
            password='93329c60badb9d8252ad6c9d5f0c07f1848948bc5bd4b42ad9301a90639e8880'),
    ]
    db.session.add_all(user_list)
    db.session.commit()

    post_list = [
        Post(
            user_id=1,
            post_name='厳島神社観光旅行',
            content='厳島神社に行きました！',
            posted_date=datetime.date(
                2020,
                8,
                20),
            traveled_flag=1,
            transportation_flag=0,
            image_name='itsukushima.jpg',
            period=1),
        Post(
            user_id=2,
            post_name='横浜近郊旅行',
            content='横浜と鎌倉に行ったよ～ん！',
            posted_date=datetime.date(
                2019,
                7,
                2),
            traveled_flag=1,
            transportation_flag=1,
            image_name='toyoda3.jpg',
            period=2),
        Post(
            user_id=5,
            post_name='広島旅行',
            content='広島に行く旅！',
            posted_date=datetime.date(
                2015,
                6,
                25),
            traveled_flag=1,
            transportation_flag=0,
            image_name='toyoda1.jpg',
            period=1),
        Post(
            user_id=1,
            post_name='中国地方周遊',
            content='広島を起点に周遊！',
            posted_date=datetime.date(
                2020,
                8,
                20),
            traveled_flag=0,
            transportation_flag=0,
            image_name='toyoda2.jpg',
            period=1),
        Post(
            user_id=5,
            post_name='四国島旅行',
            content='3つの島に行きます！',
            posted_date=datetime.date(
                2020,
                8,
                20),
            traveled_flag=0,
            transportation_flag=1,
            image_name='toyoda4.jpg',
            period=3),
        Post(
            user_id=4,
            post_name='箱根女子旅',
            content='卒業旅行行ったよ〜',
            posted_date=datetime.date(
                2020,
                3,
                20),
            traveled_flag=0,
            transportation_flag=1,
            image_name='nakano1.jpg',
            period=1),
        Post(
            user_id=4,
            post_name='栃木1泊2日',
            content='いちご美味しかった〜',
            posted_date=datetime.date(
                2019,
                3,
                21),
            traveled_flag=0,
            transportation_flag=0,
            image_name='nakano2.jpeg',
            period=1),
        Post(
            user_id=3,
            post_name='仙台旅行',
            content='牛タン美味しかった！',
            posted_date=datetime.date(
                2020,
                3,
                12),
            traveled_flag=0,
            transportation_flag=1,
            image_name='nakano3.JPEG',
            period=1),
        Post(
            user_id=2,
            post_name='茨城横断！',
            content='車で行ったよ〜',
            posted_date=datetime.date(
                2020,
                3,
                20),
            traveled_flag=1,
            transportation_flag=0,
            image_name='nakano4.jpg',
            period=1),
        Post(
            user_id=3,
            post_name='温泉旅行',
            content='群馬の伊香保温泉',
            posted_date=datetime.date(
                2020,
                3,
                20),
            traveled_flag=1,
            transportation_flag=1,
            image_name='nakano5.jpg',
            period=1),
        Post(
            user_id=5,
            post_name='京都旅！',
            content='卒業旅行してきた',
            posted_date=datetime.date(
                2020,
                3,
                20),
            traveled_flag=1,
            transportation_flag=1,
            image_name='nakano6.jpeg',
            period=1),
        Post(
            user_id=1,
            post_name='八幡神社',
            content='お参りをしてきたよ！',
            posted_date=datetime.date(
                2020,
                6,
                1),
            traveled_flag=1,
            transportation_flag=0,
            image_name='kondo_1.jpeg',
            period=1),
        Post(
            user_id=1,
            post_name='八幡神社',
            content='お参りをしてきたよ！',
            posted_date=datetime.date(
                2020,
                6,
                1),
            traveled_flag=0,
            transportation_flag=0,
            image_name='kondo_1.jpeg',
            period=1),
        Post(
            user_id=1,
            post_name='月読神社',
            content='パワースポットに行きました ^_^',
            posted_date=datetime.date(
                2019,
                9,
                20),
            traveled_flag=1,
            transportation_flag=1,
            image_name='kondo_2.jpeg',
            period=1),
    ]
    db.session.add_all(post_list)
    db.session.commit()

    schedule_list = [
        Schedule(
            # id=1,
            post_id=1,
            title='厳島神社',
            latitude=34.296047,
            longitude=132.319818,
            start_time=datetime.datetime(
                2020,
                8,
                3,
                10,
                30),
            end_time=datetime.datetime(
                2020,
                8,
                3,
                12,
                0),
            memo='厳島神社を参拝するためにはるばるやってきました',
            image_name='image1',
            transportation='車'),

        Schedule(
            # id=2,
            post_id=2,
            title='ランドマークタワー',
            latitude=35.455103,
            longitude=139.631407,
            start_time=datetime.datetime(
                2019,
                6,
                20,
                11,
                30),
            end_time=datetime.datetime(
                2019,
                6,
                20,
                12,
                00),
            memo='高い！',
            image_name='image3.jpg',
            transportation='徒歩'),

        Schedule(
            # id=2,
            post_id=2,
            title='マリンタワー',
            latitude=35.444148,
            longitude=139.650984,
            start_time=datetime.datetime(
                2019,
                6,
                20,
                12,
                30),
            end_time=datetime.datetime(
                2019,
                6,
                20,
                13,
                00),
            memo='高い！',
            image_name='image3.jpg',
            transportation='徒歩'),

        Schedule(
            # id=2,
            post_id=2,
            title='山下公園',
            latitude=35.445835,
            longitude=139.649976,
            start_time=datetime.datetime(
                2019,
                6,
                20,
                13,
                00),
            end_time=datetime.datetime(
                2019,
                6,
                20,
                15,
                00),
            memo='カップル多すぎ！',
            image_name='image3.jpg',
            transportation='徒歩'),

        Schedule(
            # id=2,
            post_id=2,
            title='中華街',
            latitude=35.442560,
            longitude=139.646431,
            start_time=datetime.datetime(
                2019,
                6,
                20,
                15,
                00),
            end_time=datetime.datetime(
                2019,
                6,
                20,
                16,
                00),
            memo='食べ歩きしたよ！',
            image_name='image3.jpg',
            transportation='徒歩'),

        Schedule(
            # id=2,
            post_id=2,
            title='鎌倉小町通り',
            latitude=35.322477,
            longitude=139.552754,
            start_time=datetime.datetime(
                2019,
                6,
                21,
                10,
                30),
            end_time=datetime.datetime(
                2019,
                6,
                20,
                11,
                30),
            memo='まめやで試食しまくり！',
            image_name='image3.jpg',
            transportation='徒歩'),

        Schedule(
            # id=2,
            post_id=2,
            title='鶴岡八幡宮',
            latitude=35.325041,
            longitude=139.556081,
            start_time=datetime.datetime(
                2019,
                6,
                20,
                12,
                30),
            end_time=datetime.datetime(
                2019,
                6,
                20,
                14,
                00),
            memo='でかい！',
            image_name='image3.jpg',
            transportation='徒歩'),

        Schedule(
            # id=2,
            post_id=2,
            title='長谷寺',
            latitude=35.312725,
            longitude=139.533032,
            start_time=datetime.datetime(
                2019,
                6,
                20,
                15,
                00),
            end_time=datetime.datetime(
                2019,
                6,
                20,
                16,
                00),
            memo='一応来た！',
            image_name='image3.jpg',
            transportation='徒歩'),

        Schedule(
            # id=4,
            post_id=3,
            title='広島駅',
            latitude=34.397862,
            longitude=132.475400,
            start_time=datetime.datetime(
                2015,
                6,
                25,
                10,
                00),
            end_time=datetime.datetime(
                2015,
                6,
                25,
                10,
                00),
            image_name='image4.jpg',
            transportation='車'),

        Schedule(
            # id=4,
            post_id=3,
            title='厳島神社',
            latitude=34.296047,
            longitude=132.319818,
            start_time=datetime.datetime(
                2015,
                6,
                25,
                11,
                30),
            end_time=datetime.datetime(
                2015,
                6,
                20,
                14,
                00),
            image_name='image4.jpg',
            transportation='車'),

        Schedule(
            # id=4,
            post_id=4,
            title='広島駅',
            latitude=34.397862,
            longitude=132.475400,
            start_time=datetime.datetime(
                2020,
                10,
                20,
                10,
                00),
            end_time=datetime.datetime(
                2020,
                10,
                20,
                10,
                00),
            memo='広島初上陸',
            image_name='image4.jpg',
            transportation='車'),

        Schedule(
            # id=4,
            post_id=4,
            title='厳島神社',
            latitude=34.296047,
            longitude=132.319818,
            start_time=datetime.datetime(
                2020,
                10,
                20,
                11,
                30),
            end_time=datetime.datetime(
                2020,
                10,
                20,
                14,
                00),
            image_name='image4.jpg',
            transportation='車'),

        Schedule(
            # id=4,
            post_id=4,
            title='原爆ドーム',
            latitude=34.395642,
            longitude=132.453560,
            start_time=datetime.datetime(
                2020,
                10,
                20,
                11,
                30),
            end_time=datetime.datetime(
                2020,
                10,
                20,
                13,
                0),
            memo='はじめていく予定',
            image_name='image4.jpg',
            transportation='車'),

        Schedule(
            # id=6,
            post_id=5,
            title='高松空港',
            latitude=34.219083,
            longitude=134.018443,
            start_time=datetime.datetime(
                2020,
                9,
                20,
                10,
                00),
            end_time=datetime.datetime(
                2020,
                9,
                20,
                10,
                00),
            image_name='image6.jpg',
            transportation='徒歩'),

        Schedule(
            # id=6,
            post_id=5,
            title='直島',
            latitude=34.461554,
            longitude=133.985832,
            start_time=datetime.datetime(
                2020,
                9,
                20,
                11,
                30),
            end_time=datetime.datetime(
                2020,
                9,
                20,
                13,
                0),
            memo='美術館がぼったくりなよかん。',
            image_name='image6.jpg',
            transportation='船'),

        Schedule(
            # id=6,
            post_id=5,
            title='豊島',
            latitude=34.483150,
            longitude=134.071803,
            start_time=datetime.datetime(
                2020,
                9,
                21,
                11,
                30),
            end_time=datetime.datetime(
                2020,
                9,
                21,
                13,
                0),
            memo='心臓音アーカイブで心臓の音録音したい',
            image_name='image6.jpg',
            transportation='船'),

        Schedule(
            # id=6,
            post_id=5,
            title='小豆島',
            latitude=34.513628,
            longitude=134.303675,
            start_time=datetime.datetime(
                2020,
                9,
                22,
                11,
                30),
            end_time=datetime.datetime(
                2020,
                9,
                22,
                13,
                0),
            image_name='image6.jpg',
            transportation='船'),

        Schedule(
            # id=6,
            post_id=5,
            title='高松のうどん店',
            latitude=34.337415,
            longitude=134.058420,
            start_time=datetime.datetime(
                2020,
                9,
                22,
                15,
                30),
            end_time=datetime.datetime(
                2020,
                9,
                22,
                17,
                0),
            memo='4杯食べた',
            image_name='image6.jpg',
            transportation='船'),

        Schedule(
            # id=6,
            post_id=5,
            title='高松空港',
            latitude=34.219083,
            longitude=134.018443,
            start_time=datetime.datetime(
                2020,
                9,
                22,
                17,
                30),
            end_time=datetime.datetime(
                2020,
                9,
                22,
                18,
                0),
            image_name='image6.jpg',
            transportation='バス'),
        Schedule(
            # id=12,
            post_id=7,
            title='箱根湯本駅',
            latitude=35.233383,
            longitude=139.103916,
            start_time=datetime.datetime(
                2020,
                3,
                20,
                13,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                20,
                14,
                0),
            transportation='電車',
            memo='電車で', ),
        Schedule(
            post_id=7,
            title='茶のちもと',
            latitude=35.231571,
            longitude=139.10068,
            start_time=datetime.datetime(
                2020,
                3,
                20,
                14,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                20,
                16,
                0),
            transportation='徒歩',
            memo='美味しい', ),
        Schedule(
            post_id=7,
            title='箱根湯本ホテル',
            latitude=35.232513,
            longitude=139.10445,
            start_time=datetime.datetime(
                2020,
                3,
                20,
                16,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                20,
                18,
                0),
            transportation='電車',
            memo='チェックイン', ),
        Schedule(
            post_id=7,
            title='芦ノ湖',
            latitude=35.209567,
            longitude=139.003463,
            start_time=datetime.datetime(
                2020,
                3,
                21,
                10,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                20,
                12,
                0),
            transportation='電車',
            memo='', ),
        Schedule(
            post_id=7,
            title='箱根神社',
            latitude=35.204678,
            longitude=139.025385,
            start_time=datetime.datetime(
                2020,
                3,
                21,
                12,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                21,
                14,
                0),
            transportation='電車',
            memo='', ),
        Schedule(
            post_id=8,
            title='宇都宮',
            latitude=36.555075,
            longitude=139.882621,
            start_time=datetime.datetime(
                2020,
                3,
                20,
                10,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                20,
                12,
                0),
            transportation='車',
            memo='', ),
        Schedule(
            post_id=8,
            title='出会いの森いちご園',
            latitude=36.545937,
            longitude=139.720382,
            start_time=datetime.datetime(
                2020,
                3,
                20,
                12,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                20,
                14,
                0),
            transportation='車',
            memo='', ),
        Schedule(
            post_id=8,
            title='日光東照宮',
            latitude=36.757804,
            longitude=139.599358,
            start_time=datetime.datetime(
                2020,
                3,
                21,
                12,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                21,
                14,
                0),
            transportation='車',
            memo='', ),
        Schedule(
            post_id=8,
            title='日光江戸村',
            latitude=36.790783,
            longitude=139.69746,
            start_time=datetime.datetime(
                2020,
                3,
                21,
                14,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                21,
                16,
                0),
            transportation='車',
            memo='', ),
        Schedule(
            post_id=9,
            title='仙台駅',
            latitude=38.260132,
            longitude=140.882438,
            start_time=datetime.datetime(
                2020,
                3,
                21,
                14,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                21,
                16,
                0),
            transportation='電車',
            memo='', ),
        Schedule(
            post_id=9,
            title='塩釜市場',
            latitude=38.327358,
            longitude=141.043843,
            start_time=datetime.datetime(
                2020,
                3,
                22,
                10,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                22,
                12,
                0),
            transportation='電車',
            memo='', ),
        Schedule(
            post_id=9,
            title='松島',
            latitude=38.380191,
            longitude=141.067293,
            start_time=datetime.datetime(
                2020,
                3,
                22,
                12,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                22,
                14,
                0),
            transportation='電車',
            memo='', ),
        Schedule(
            post_id=10,
            title='つくば',
            latitude=36.083526,
            longitude=140.076445,
            start_time=datetime.datetime(
                2020,
                3,
                22,
                10,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                22,
                12,
                0),
            transportation='車',
            memo='', ),
        Schedule(
            post_id=10,
            title='大洗',
            latitude=36.313399,
            longitude=140.574879,
            start_time=datetime.datetime(
                2020,
                3,
                22,
                12,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                22,
                16,
                0),
            transportation='車',
            memo='', ),
        Schedule(
            post_id=10,
            title='水戸',
            latitude=36.365876,
            longitude=140.471372,
            start_time=datetime.datetime(
                2020,
                3,
                22,
                16,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                22,
                18,
                0),
            transportation='車',
            memo='', ),
        Schedule(
            post_id=11,
            title='七重滝',
            latitude=36.622867,
            longitude=138.596806,
            start_time=datetime.datetime(
                2020,
                3,
                22,
                14,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                22,
                16,
                0),
            transportation='車',
            memo='', ),
        Schedule(
            post_id=11,
            title='伊香保温泉',
            latitude=36.496447,
            longitude=138.915011,
            start_time=datetime.datetime(
                2020,
                3,
                22,
                16,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                22,
                18,
                0),
            transportation='車',
            memo='', ),
        Schedule(
            post_id=12,
            title='京都駅',
            latitude=34.985849,
            longitude=135.758767,
            start_time=datetime.datetime(
                2020,
                3,
                22,
                13,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                22,
                14,
                0),
            transportation='電車',
            memo='', ),
        Schedule(
            post_id=12,
            title='金閣',
            latitude=35.039509,
            longitude=135.728453,
            start_time=datetime.datetime(
                2020,
                3,
                22,
                14,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                22,
                16,
                0),
            transportation='電車',
            memo='', ),
        Schedule(
            post_id=12,
            title='八坂神社',
            latitude=35.003656,
            longitude=135.778553,
            start_time=datetime.datetime(
                2020,
                3,
                23,
                14,
                0),
            end_time=datetime.datetime(
                2020,
                3,
                22,
                16,
                0),
            transportation='電車',
            memo='', ),
        Schedule(
            post_id=13,
            title='八幡神社',
            latitude=35.70479,
            longitude=138.689947,
            start_time=datetime.datetime(
                2020,
                6,
                1,
                10,
                30),
            end_time=datetime.datetime(
                2020,
                6,
                1,
                12,
                0),
            memo='',
            transportation='車'),
        Schedule(
            post_id=14,
            title='月読神社',
            latitude=35.58061,
            longitude=139.504976,
            start_time=datetime.datetime(
                2019,
                9,
                20,
                13,
                30),
            end_time=datetime.datetime(
                2019,
                9,
                20,
                18,
                0),
            memo='',
            transportation='電車'),
    ]
    db.session.add_all(schedule_list)
    db.session.commit()

    # comment table 初期データ written by Keisuke Toyoda
    comment_list = [
        Comment(
            commenter_id=2,
            post_id=1,
            comment_time=datetime.datetime(
                2020,
                7,
                20,
                11,
                30),
            comment="厳島神社いいですね～"),
        Comment(
            commenter_id=3,
            post_id=1,
            comment_time=datetime.datetime(
                2020,
                7,
                20,
                11,
                45),
            comment="厳島神社私も行きたいです！"),
        Comment(
            commenter_id=1,
            post_id=1,
            comment_time=datetime.datetime(
                2020,
                7,
                20,
                11,
                50),
            comment="いいとこでしたよ～ぜひぜひ^^"),
        Comment(
            commenter_id=5,
            post_id=2,
            comment_time=datetime.datetime(
                2020,
                7,
                20,
                14,
                30),
            comment="ランドマークの展望台どうでした？？"),
        Comment(
            commenter_id=2,
            post_id=2,
            comment_time=datetime.datetime(
                2020,
                7,
                20,
                15,
                45),
            comment="めっちゃおすすめです。でもコロナで営業時間短縮してるっぽいです"),
        Comment(
            commenter_id=5,
            post_id=2,
            comment_time=datetime.datetime(
                2020,
                7,
                20,
                15,
                50),
            comment="ありがとうございます。サンクスです。"),
    ]
    db.session.add_all(comment_list)
    db.session.commit()
