import React, { useEffect } from 'react';
import { View } from 'react-native';
import Svg, { Path } from 'react-native-svg';
import Animated, {
    useSharedValue,
    useAnimatedStyle,
    withRepeat,
    withSequence,
    withTiming,
    Easing
} from 'react-native-reanimated';
import useChristmasTheme from '../../hooks/useChristmasTheme';

const AnimatedView = Animated.createAnimatedComponent(View);

interface ChristmasPinIconProps {
    size?: number;
}

const ChristmasPinIcon: React.FC<ChristmasPinIconProps> = ({ size = 32 }) => {
    const { isEnabled: hasChristmasTheme } = useChristmasTheme();
    const float = useSharedValue(0);

    useEffect(() => {
        if (hasChristmasTheme) {
            float.value = withRepeat(
                withSequence(
                    withTiming(1, {
                        duration: 2000,
                        easing: Easing.inOut(Easing.ease)
                    }),
                    withTiming(0, {
                        duration: 2000,
                        easing: Easing.inOut(Easing.ease)
                    })
                ),
                -1,
                false
            );
        }
    }, [hasChristmasTheme, float]);

    const animatedStyle = useAnimatedStyle(() => {
        return {
            transform: [{ translateY: float.value * -1.5 }]
        };
    });

    if (!hasChristmasTheme) {
        return null;
    }

    return (
        <AnimatedView style={animatedStyle}>
            <Svg height={size} width={size} viewBox="0 0 1246 1189">
                <Path
                    d="M354.218 537.156C401.988 584.028 455.661 624.478 513.882 657.484C703.325 766.859 837.109 753.888 837.109 753.888C858.614 766.347 874.301 786.823 880.734 810.829C887.166 834.834 883.818 860.411 871.424 881.953L811.502 985.741C798.098 1008.9 777.624 1027.16 753.084 1037.83C728.543 1048.5 701.229 1051.03 675.147 1045.04C570.861 1019.15 471.034 977.815 378.976 922.398L351.913 906.773C257.891 854.757 172.178 788.972 97.6167 711.601C79.3886 692.009 67.9194 667.091 64.8916 640.502C61.8638 613.914 67.4369 587.055 80.7932 563.866L140.715 460.078C153.147 438.545 173.624 422.833 197.641 416.397C221.657 409.962 247.247 413.331 268.78 425.763C279.386 446.576 292.196 466.191 306.99 484.269C311.017 489.481 315.451 494.927 320.29 500.608C329.968 511.969 341.271 524.268 354.218 537.156Z"
                    fill="#E0E0FB"
                />
                <Path
                    d="M868.225 555.345L944.408 599.33C955.174 605.546 967.969 607.23 979.978 604.012C991.986 600.795 1002.22 592.939 1008.44 582.172C1034.14 537.653 1026.09 482.848 1007.69 433.791C1014.6 436.608 1020.94 440.641 1026.43 445.696C1035.74 440.793 1046.13 438.327 1056.65 438.53C1067.16 438.733 1077.46 441.598 1086.56 446.856C1095.67 452.115 1103.3 459.597 1108.73 468.602C1114.17 477.607 1117.23 487.843 1117.64 498.353C1127.68 501.476 1136.78 507.093 1144.07 514.68C1151.36 522.266 1156.61 531.575 1159.34 541.739C1162.06 551.903 1162.17 562.592 1159.65 572.808C1157.12 583.024 1152.06 592.435 1144.92 600.164C1149.82 609.469 1152.29 619.864 1152.08 630.38C1151.88 640.896 1149.01 651.188 1143.76 660.297C1138.5 669.405 1131.02 677.032 1122.01 682.466C1113.01 687.899 1102.77 690.962 1092.26 691.368C1089.14 701.416 1083.52 710.51 1075.93 717.801C1068.35 725.093 1059.04 730.346 1048.87 733.069C1038.71 735.793 1028.02 735.898 1017.8 733.377C1007.59 730.855 998.178 725.788 990.448 718.648C981.144 723.551 970.748 726.017 960.233 725.814C949.717 725.611 939.424 722.747 930.316 717.488C921.207 712.229 913.58 704.748 908.147 695.742C902.713 686.737 899.651 676.501 899.245 665.992C889.181 662.897 880.071 657.289 872.774 649.699C865.477 642.108 860.233 632.785 857.537 622.607C855.876 616.575 855.165 610.32 855.43 604.069C855.974 589.219 861.843 575.06 871.965 564.18C870.462 561.35 869.21 558.394 868.225 555.345V555.345Z"
                    fill="#E0E0FB"
                />
                <Path
                    d="M650.075 515.276C645.334 523.445 637.94 529.745 629.123 533.129C620.311 536.45 610.607 536.538 601.737 533.376C549.142 515.098 439.357 487.438 354.191 537.138C341.244 524.25 329.942 511.952 320.263 500.59C315.424 494.909 310.991 489.463 306.963 484.251L307.255 484.059C372.847 456.074 491.17 398.634 630.584 457.474C635.898 459.714 640.676 463.058 644.6 467.283C648.525 471.509 651.508 476.52 653.351 481.984C655.193 487.449 655.854 493.243 655.29 498.982C654.725 504.722 652.948 510.275 650.075 515.276V515.276Z"
                    fill="#FC4051"
                />
                <Path
                    d="M939.233 452.004C951.071 352.75 821.826 286.61 775.775 265.435C771.917 263.708 767.552 263.493 763.544 264.833C759.535 266.172 756.176 268.968 754.131 272.666C752.087 276.365 751.506 280.697 752.504 284.804C753.501 288.91 756.005 292.492 759.519 294.841C795.304 319.109 889.863 392.828 867.388 482.693C858.011 522.333 851.248 562.546 847.142 603.073C838.278 683.114 837.11 753.887 837.11 753.887C837.11 753.887 703.326 766.857 513.883 657.482C455.662 624.476 401.989 584.027 354.218 537.154C439.385 487.454 549.169 515.114 601.764 533.392C610.635 536.554 620.339 536.466 629.15 533.146C637.968 529.761 645.362 523.461 650.103 515.292C652.975 510.292 654.753 504.738 655.317 498.998C655.882 493.259 655.221 487.465 653.378 482C651.536 476.536 648.553 471.525 644.628 467.299C640.703 463.074 635.925 459.73 630.611 457.49C491.197 398.65 372.875 456.091 307.282 484.075L306.991 484.267C292.197 466.189 279.387 446.575 268.781 425.762L481.331 290.113C530.413 246.569 591.956 219.578 657.237 212.967C722.517 206.356 788.221 220.461 845.037 253.282L884.685 276.172C922.31 297.788 953.627 328.868 975.527 366.329C988.138 387.859 998.891 410.424 1007.67 433.781C1026.08 482.837 1034.13 537.643 1008.42 582.162L982.714 567.318C963.228 556.112 948.238 538.486 940.307 517.453C932.376 496.42 931.997 473.286 939.233 452.004V452.004Z"
                    fill="#FC4051"
                />
                <Path
                    d="M979.932 603.961C985.879 602.378 991.455 599.636 996.341 595.893C1001.23 592.15 1005.33 587.479 1008.4 582.149L982.692 567.305C963.206 556.099 948.216 538.473 940.285 517.44C932.355 496.407 931.975 473.273 939.211 451.991C951.049 352.737 821.804 286.597 775.753 265.422C771.895 263.695 767.53 263.48 763.522 264.82C759.513 266.159 756.154 268.955 754.109 272.653C752.065 276.352 751.484 280.684 752.482 284.791C753.479 288.897 755.983 292.479 759.497 294.828C795.282 319.096 889.841 392.815 867.367 482.68C862.27 502.976 858.098 525.014 854.56 547.455L944.37 599.306C949.699 602.384 955.584 604.38 961.687 605.178C967.789 605.977 973.989 605.563 979.932 603.961Z"
                    fill="#FC4051"
                />
                <Path
                    d="M880.737 810.829C877.604 798.92 872.134 787.753 864.644 777.977C857.155 768.202 847.797 760.013 837.113 753.888C837.113 753.888 703.329 766.859 513.886 657.484C455.665 624.478 401.992 584.028 354.222 537.156C341.275 524.268 329.972 511.969 320.294 500.608C315.455 494.927 311.021 489.481 306.994 484.269C292.2 466.191 279.39 446.577 268.784 425.763C250.064 414.978 228.197 410.981 206.873 414.447C185.549 417.912 166.073 428.628 151.731 444.786C149.193 453.433 148.547 462.525 149.835 471.444C151.124 480.363 154.318 488.901 159.199 496.476C190.748 545.488 273.17 639.01 480.543 746.486C559.697 787.513 619.026 814.658 663.451 832.368C684.66 840.751 702.758 855.487 715.265 874.557C727.772 893.627 734.076 916.099 733.313 938.891C732.549 961.684 724.756 983.684 711.002 1001.87C697.247 1020.07 678.204 1033.56 656.481 1040.5C662.927 1042.15 669.219 1043.69 675.151 1045.04C701.233 1051.03 728.548 1048.5 753.088 1037.83C777.628 1027.16 798.102 1008.9 811.506 985.741L871.428 881.953C877.618 871.307 881.628 859.537 883.226 847.326C884.825 835.116 883.979 822.709 880.737 810.829V810.829Z"
                    fill="#E0E0FB"
                />
                <Path
                    d="M926.544 683.396C933.877 690.199 942.817 695.031 952.526 697.439C962.236 699.847 972.397 699.751 982.06 697.162C991.722 694.573 1000.57 689.575 1007.77 682.635C1014.98 675.695 1020.31 667.041 1023.25 657.482C1033.23 657.097 1042.95 654.19 1051.5 649.03C1060.06 643.871 1067.16 636.628 1072.15 627.979C1077.15 619.33 1079.87 609.557 1080.06 599.571C1080.25 589.586 1077.91 579.715 1073.25 570.88C1080.06 563.548 1084.9 554.608 1087.31 544.898C1089.72 535.188 1089.62 525.025 1087.03 515.361C1084.44 505.697 1079.44 496.848 1072.5 489.644C1065.56 482.439 1056.9 477.115 1047.34 474.169C1046.83 462.494 1042.9 451.225 1036.05 441.759C1032.73 442.802 1029.51 444.114 1026.4 445.682C1020.92 440.626 1014.57 436.594 1007.66 433.776C1026.09 482.848 1034.14 537.654 1008.44 582.173C1002.22 592.94 991.985 600.796 979.977 604.013C967.969 607.231 955.174 605.547 944.407 599.331L868.224 555.346C869.21 558.395 870.461 561.351 871.964 564.181C861.842 575.061 855.973 589.22 855.429 604.07C855.164 610.321 855.875 616.575 857.537 622.607C860.233 632.786 865.477 642.109 872.774 649.7C880.071 657.29 889.181 662.897 899.244 665.993C899.648 674.26 901.658 682.37 905.162 689.869C912.631 689.065 919.883 686.87 926.544 683.396V683.396Z"
                    fill="#E0E0FB"
                />
                <Path
                    d="M1099.06 622.062C1112.75 618.389 1119.7 599.967 1114.59 580.914C1109.47 561.861 1094.24 549.392 1080.55 553.065C1066.86 556.737 1059.92 575.159 1065.03 594.212C1070.14 613.265 1085.38 625.734 1099.06 622.062Z"
                    fill="#E0E0FB"
                />
                <Path
                    d="M1076.59 666.969C1083.46 665.124 1086.96 655.872 1084.39 646.304C1081.82 636.735 1074.17 630.475 1067.29 632.32C1060.42 634.165 1056.92 643.417 1059.49 652.985C1062.06 662.553 1069.71 668.814 1076.59 666.969Z"
                    fill="#E0E0FB"
                />
                <Path
                    d="M516.46 715.462C519.635 710.187 521.739 704.338 522.653 698.249C523.567 692.16 523.273 685.951 521.786 679.976C520.3 674.001 517.651 668.378 513.991 663.427C510.331 658.476 505.732 654.294 500.455 651.121C492.203 646.164 483.924 640.951 475.619 635.483C465.228 628.637 452.543 626.199 440.355 628.705C428.167 631.212 417.474 638.457 410.628 648.848C403.782 659.239 401.344 671.923 403.85 684.111C406.356 696.3 413.602 706.993 423.993 713.839C432.868 719.685 441.693 725.213 450.455 730.506C451.943 731.365 453.554 732.169 455.074 732.974C465.62 738.379 477.825 739.578 489.221 736.327C500.617 733.076 510.353 725.618 516.46 715.462V715.462Z"
                    fill="#E0E0FB"
                />
                <Path
                    d="M530.732 722.78C526.303 733.305 525.869 745.085 529.51 755.907C533.151 766.73 540.618 775.851 550.508 781.559C552.224 782.545 553.996 783.43 555.816 784.209C635.058 816.821 718.575 837.879 803.807 846.738L808.33 847.31C820.518 848.617 832.732 845.098 842.357 837.507C851.981 829.916 858.249 818.857 859.817 806.7C861.385 794.543 858.129 782.255 850.747 772.47C843.364 762.685 832.442 756.181 820.322 754.352C744.039 751.133 669.135 732.936 599.877 700.799C597.294 699.741 594.79 698.89 592.175 697.795C586.5 695.398 580.409 694.142 574.249 694.101C568.089 694.059 561.981 695.232 556.275 697.552C550.568 699.873 545.375 703.295 540.992 707.624C536.609 711.953 533.123 717.103 530.732 722.78V722.78Z"
                    fill="#E0E0FB"
                />
                <Path
                    d="M530.386 514.772C519.138 488.409 511.898 460.511 508.907 432.006C423.416 431.236 352.714 464.696 307.254 484.06L306.962 484.252C310.99 489.464 315.423 494.911 320.262 500.591C329.941 511.953 341.243 524.252 354.19 537.139C410.049 504.546 476.416 505.281 530.386 514.772Z"
                    fill="#FC4051"
                />
                <Path
                    d="M508.934 432.022C502.511 371.836 515.359 311.164 545.628 258.748L555.659 241.374C528.674 253.992 503.638 270.415 481.315 290.141L268.78 425.762C279.386 446.576 292.196 466.19 306.99 484.268L307.282 484.076C352.742 464.712 423.444 431.252 508.934 432.022Z"
                    fill="#FC4051"
                />
                <Path
                    d="M530.431 514.796C476.401 505.253 410.053 504.546 354.235 537.163C402.005 584.036 455.678 624.486 513.899 657.492C703.342 766.867 837.126 753.896 837.126 753.896C837.126 753.896 837.323 742.336 838.118 723.49C774.441 708.119 713.096 684.332 655.701 652.759C599.467 622.359 555.279 573.694 530.431 514.796Z"
                    fill="#FC4051"
                />
                <Path
                    d="M850.876 439.421C841.839 383.199 798.238 332.406 738.715 337.282C724.499 338.438 698.593 333.964 690.883 351.38C689.212 355.781 688.671 360.531 689.312 365.195C691.767 395.318 709.939 420.406 720.914 447.959C731.356 480.432 739.252 513.668 744.53 547.367C748.717 566.022 757.228 587.03 775.533 590.201C792.154 593.067 807.953 579.329 818.604 565.037C845.552 529.082 857.156 483.914 850.876 439.421V439.421Z"
                    fill="#FC4051"
                />
            </Svg>
        </AnimatedView>
    );
};

export default ChristmasPinIcon;
