@rjromeoent/ein-supabase 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2046,6 +2046,291 @@ export type Database = {
2046
2046
  }
2047
2047
  ];
2048
2048
  };
2049
+ prospect_event_directory: {
2050
+ Row: {
2051
+ active: boolean;
2052
+ city: string | null;
2053
+ confidence_score: number;
2054
+ created_at: string;
2055
+ created_by: string | null;
2056
+ event_name: string;
2057
+ event_name_normalized: string | null;
2058
+ event_type: string | null;
2059
+ id: string;
2060
+ known_reg_client_flag: boolean;
2061
+ month_usually_held: number | null;
2062
+ notes: string | null;
2063
+ organization_id: string;
2064
+ source: string;
2065
+ state: string | null;
2066
+ updated_at: string;
2067
+ venue_id: string | null;
2068
+ venue_name: string | null;
2069
+ website_url: string | null;
2070
+ week_of_month: number | null;
2071
+ };
2072
+ Insert: {
2073
+ active?: boolean;
2074
+ city?: string | null;
2075
+ confidence_score?: number;
2076
+ created_at?: string;
2077
+ created_by?: string | null;
2078
+ event_name: string;
2079
+ event_name_normalized?: string | null;
2080
+ event_type?: string | null;
2081
+ id?: string;
2082
+ known_reg_client_flag?: boolean;
2083
+ month_usually_held?: number | null;
2084
+ notes?: string | null;
2085
+ organization_id: string;
2086
+ source: string;
2087
+ state?: string | null;
2088
+ updated_at?: string;
2089
+ venue_id?: string | null;
2090
+ venue_name?: string | null;
2091
+ website_url?: string | null;
2092
+ week_of_month?: number | null;
2093
+ };
2094
+ Update: {
2095
+ active?: boolean;
2096
+ city?: string | null;
2097
+ confidence_score?: number;
2098
+ created_at?: string;
2099
+ created_by?: string | null;
2100
+ event_name?: string;
2101
+ event_name_normalized?: string | null;
2102
+ event_type?: string | null;
2103
+ id?: string;
2104
+ known_reg_client_flag?: boolean;
2105
+ month_usually_held?: number | null;
2106
+ notes?: string | null;
2107
+ organization_id?: string;
2108
+ source?: string;
2109
+ state?: string | null;
2110
+ updated_at?: string;
2111
+ venue_id?: string | null;
2112
+ venue_name?: string | null;
2113
+ website_url?: string | null;
2114
+ week_of_month?: number | null;
2115
+ };
2116
+ Relationships: [];
2117
+ };
2118
+ prospect_event_matches: {
2119
+ Row: {
2120
+ created_at: string;
2121
+ directory_event_id: string | null;
2122
+ id: string;
2123
+ match_breakdown: Json;
2124
+ match_confidence: number;
2125
+ match_status: Database["atlas"]["Enums"]["prospect_event_match_status"];
2126
+ organization_id: string;
2127
+ override_directory_event_id: string | null;
2128
+ play_history_id: string;
2129
+ reviewed_at: string | null;
2130
+ reviewed_by: string | null;
2131
+ updated_at: string;
2132
+ };
2133
+ Insert: {
2134
+ created_at?: string;
2135
+ directory_event_id?: string | null;
2136
+ id?: string;
2137
+ match_breakdown?: Json;
2138
+ match_confidence: number;
2139
+ match_status: Database["atlas"]["Enums"]["prospect_event_match_status"];
2140
+ organization_id: string;
2141
+ override_directory_event_id?: string | null;
2142
+ play_history_id: string;
2143
+ reviewed_at?: string | null;
2144
+ reviewed_by?: string | null;
2145
+ updated_at?: string;
2146
+ };
2147
+ Update: {
2148
+ created_at?: string;
2149
+ directory_event_id?: string | null;
2150
+ id?: string;
2151
+ match_breakdown?: Json;
2152
+ match_confidence?: number;
2153
+ match_status?: Database["atlas"]["Enums"]["prospect_event_match_status"];
2154
+ organization_id?: string;
2155
+ override_directory_event_id?: string | null;
2156
+ play_history_id?: string;
2157
+ reviewed_at?: string | null;
2158
+ reviewed_by?: string | null;
2159
+ updated_at?: string;
2160
+ };
2161
+ Relationships: [
2162
+ {
2163
+ foreignKeyName: "prospect_event_matches_directory_event_id_fkey";
2164
+ columns: ["directory_event_id"];
2165
+ isOneToOne: false;
2166
+ referencedRelation: "prospect_event_directory";
2167
+ referencedColumns: ["id"];
2168
+ },
2169
+ {
2170
+ foreignKeyName: "prospect_event_matches_override_directory_event_id_fkey";
2171
+ columns: ["override_directory_event_id"];
2172
+ isOneToOne: false;
2173
+ referencedRelation: "prospect_event_directory";
2174
+ referencedColumns: ["id"];
2175
+ },
2176
+ {
2177
+ foreignKeyName: "prospect_event_matches_play_history_id_fkey";
2178
+ columns: ["play_history_id"];
2179
+ isOneToOne: false;
2180
+ referencedRelation: "v_candidate_routed_external_events";
2181
+ referencedColumns: ["play_history_id"];
2182
+ },
2183
+ {
2184
+ foreignKeyName: "prospect_event_matches_play_history_id_fkey";
2185
+ columns: ["play_history_id"];
2186
+ isOneToOne: false;
2187
+ referencedRelation: "v_prospect_routing_pairs";
2188
+ referencedColumns: ["play_history_id"];
2189
+ }
2190
+ ];
2191
+ };
2192
+ prospect_routing_observations: {
2193
+ Row: {
2194
+ artist_id: string;
2195
+ artist_price_tier: Database["core"]["Enums"]["artist_price_tier"] | null;
2196
+ created_at: string;
2197
+ date_offset_days: number;
2198
+ directory_event_id: string | null;
2199
+ distance_miles: number;
2200
+ id: string;
2201
+ observation_year: number;
2202
+ organization_id: string;
2203
+ play_history_id: string;
2204
+ prospect_date: string;
2205
+ reg_date: string;
2206
+ reg_event_edition_id: string;
2207
+ };
2208
+ Insert: {
2209
+ artist_id: string;
2210
+ artist_price_tier?: Database["core"]["Enums"]["artist_price_tier"] | null;
2211
+ created_at?: string;
2212
+ date_offset_days: number;
2213
+ directory_event_id?: string | null;
2214
+ distance_miles: number;
2215
+ id?: string;
2216
+ observation_year: number;
2217
+ organization_id: string;
2218
+ play_history_id: string;
2219
+ prospect_date: string;
2220
+ reg_date: string;
2221
+ reg_event_edition_id: string;
2222
+ };
2223
+ Update: {
2224
+ artist_id?: string;
2225
+ artist_price_tier?: Database["core"]["Enums"]["artist_price_tier"] | null;
2226
+ created_at?: string;
2227
+ date_offset_days?: number;
2228
+ directory_event_id?: string | null;
2229
+ distance_miles?: number;
2230
+ id?: string;
2231
+ observation_year?: number;
2232
+ organization_id?: string;
2233
+ play_history_id?: string;
2234
+ prospect_date?: string;
2235
+ reg_date?: string;
2236
+ reg_event_edition_id?: string;
2237
+ };
2238
+ Relationships: [
2239
+ {
2240
+ foreignKeyName: "prospect_routing_observations_directory_event_id_fkey";
2241
+ columns: ["directory_event_id"];
2242
+ isOneToOne: false;
2243
+ referencedRelation: "prospect_event_directory";
2244
+ referencedColumns: ["id"];
2245
+ },
2246
+ {
2247
+ foreignKeyName: "prospect_routing_observations_play_history_id_fkey";
2248
+ columns: ["play_history_id"];
2249
+ isOneToOne: false;
2250
+ referencedRelation: "v_candidate_routed_external_events";
2251
+ referencedColumns: ["play_history_id"];
2252
+ },
2253
+ {
2254
+ foreignKeyName: "prospect_routing_observations_play_history_id_fkey";
2255
+ columns: ["play_history_id"];
2256
+ isOneToOne: false;
2257
+ referencedRelation: "v_prospect_routing_pairs";
2258
+ referencedColumns: ["play_history_id"];
2259
+ }
2260
+ ];
2261
+ };
2262
+ prospect_scores: {
2263
+ Row: {
2264
+ avg_distance_miles: number | null;
2265
+ computed_at: string;
2266
+ converted_lead_id: string | null;
2267
+ directory_event_id: string;
2268
+ final_score: number;
2269
+ id: string;
2270
+ organization_id: string;
2271
+ reg_overlap_count: number;
2272
+ repeat_year_count: number;
2273
+ score_breakdown: Json;
2274
+ scored_for_year: number;
2275
+ status: Database["atlas"]["Enums"]["prospect_status"];
2276
+ status_changed_at: string | null;
2277
+ status_changed_by: string | null;
2278
+ status_reason: string | null;
2279
+ unique_artist_count: number;
2280
+ };
2281
+ Insert: {
2282
+ avg_distance_miles?: number | null;
2283
+ computed_at?: string;
2284
+ converted_lead_id?: string | null;
2285
+ directory_event_id: string;
2286
+ final_score: number;
2287
+ id?: string;
2288
+ organization_id: string;
2289
+ reg_overlap_count?: number;
2290
+ repeat_year_count?: number;
2291
+ score_breakdown: Json;
2292
+ scored_for_year: number;
2293
+ status?: Database["atlas"]["Enums"]["prospect_status"];
2294
+ status_changed_at?: string | null;
2295
+ status_changed_by?: string | null;
2296
+ status_reason?: string | null;
2297
+ unique_artist_count?: number;
2298
+ };
2299
+ Update: {
2300
+ avg_distance_miles?: number | null;
2301
+ computed_at?: string;
2302
+ converted_lead_id?: string | null;
2303
+ directory_event_id?: string;
2304
+ final_score?: number;
2305
+ id?: string;
2306
+ organization_id?: string;
2307
+ reg_overlap_count?: number;
2308
+ repeat_year_count?: number;
2309
+ score_breakdown?: Json;
2310
+ scored_for_year?: number;
2311
+ status?: Database["atlas"]["Enums"]["prospect_status"];
2312
+ status_changed_at?: string | null;
2313
+ status_changed_by?: string | null;
2314
+ status_reason?: string | null;
2315
+ unique_artist_count?: number;
2316
+ };
2317
+ Relationships: [
2318
+ {
2319
+ foreignKeyName: "prospect_scores_converted_lead_id_fkey";
2320
+ columns: ["converted_lead_id"];
2321
+ isOneToOne: false;
2322
+ referencedRelation: "leads";
2323
+ referencedColumns: ["id"];
2324
+ },
2325
+ {
2326
+ foreignKeyName: "prospect_scores_directory_event_id_fkey";
2327
+ columns: ["directory_event_id"];
2328
+ isOneToOne: false;
2329
+ referencedRelation: "prospect_event_directory";
2330
+ referencedColumns: ["id"];
2331
+ }
2332
+ ];
2333
+ };
2049
2334
  service_agreement_renewal_alerts: {
2050
2335
  Row: {
2051
2336
  alert_type: Database["atlas"]["Enums"]["service_agreement_renewal_alert_type"];
@@ -2373,8 +2658,127 @@ export type Database = {
2373
2658
  };
2374
2659
  Relationships: [];
2375
2660
  };
2661
+ v_candidate_routed_external_events: {
2662
+ Row: {
2663
+ artist_id: string | null;
2664
+ auto_directory_event_id: string | null;
2665
+ effective_directory_event_id: string | null;
2666
+ external_confidence_score: number | null;
2667
+ external_event_name: string | null;
2668
+ external_event_type: string | null;
2669
+ external_source: string | null;
2670
+ match_status: Database["atlas"]["Enums"]["prospect_event_match_status"] | null;
2671
+ organization_id: string | null;
2672
+ override_directory_event_id: string | null;
2673
+ play_history_id: string | null;
2674
+ prospect_city: string | null;
2675
+ prospect_date: string | null;
2676
+ prospect_lat: number | null;
2677
+ prospect_lng: number | null;
2678
+ prospect_market_id: string | null;
2679
+ prospect_state: string | null;
2680
+ prospect_venue_id: string | null;
2681
+ };
2682
+ Relationships: [
2683
+ {
2684
+ foreignKeyName: "prospect_event_matches_directory_event_id_fkey";
2685
+ columns: ["auto_directory_event_id"];
2686
+ isOneToOne: false;
2687
+ referencedRelation: "prospect_event_directory";
2688
+ referencedColumns: ["id"];
2689
+ },
2690
+ {
2691
+ foreignKeyName: "prospect_event_matches_override_directory_event_id_fkey";
2692
+ columns: ["override_directory_event_id"];
2693
+ isOneToOne: false;
2694
+ referencedRelation: "prospect_event_directory";
2695
+ referencedColumns: ["id"];
2696
+ }
2697
+ ];
2698
+ };
2699
+ v_prospect_routing_pairs: {
2700
+ Row: {
2701
+ artist_id: string | null;
2702
+ date_offset_days: number | null;
2703
+ directory_event_id: string | null;
2704
+ distance_miles: number | null;
2705
+ match_status: Database["atlas"]["Enums"]["prospect_event_match_status"] | null;
2706
+ observation_year: number | null;
2707
+ organization_id: string | null;
2708
+ play_history_id: string | null;
2709
+ prospect_date: string | null;
2710
+ reg_date: string | null;
2711
+ reg_event_edition_id: string | null;
2712
+ };
2713
+ Relationships: [];
2714
+ };
2715
+ v_reg_confirmed_artist_events: {
2716
+ Row: {
2717
+ artist_id: string | null;
2718
+ event_edition_id: string | null;
2719
+ offer_id: string | null;
2720
+ organization_id: string | null;
2721
+ reg_city: string | null;
2722
+ reg_date: string | null;
2723
+ reg_lat: number | null;
2724
+ reg_lng: number | null;
2725
+ reg_market_id: string | null;
2726
+ reg_state: string | null;
2727
+ reg_venue_id: string | null;
2728
+ };
2729
+ Relationships: [];
2730
+ };
2731
+ v_top_prospects: {
2732
+ Row: {
2733
+ avg_distance_miles: number | null;
2734
+ city: string | null;
2735
+ computed_at: string | null;
2736
+ converted_lead_id: string | null;
2737
+ directory_event_id: string | null;
2738
+ event_name: string | null;
2739
+ event_type: string | null;
2740
+ final_score: number | null;
2741
+ known_reg_client_flag: boolean | null;
2742
+ month_usually_held: number | null;
2743
+ organization_id: string | null;
2744
+ prospect_score_id: string | null;
2745
+ reg_overlap_count: number | null;
2746
+ repeat_year_count: number | null;
2747
+ score_breakdown: Json | null;
2748
+ scored_for_year: number | null;
2749
+ state: string | null;
2750
+ status: Database["atlas"]["Enums"]["prospect_status"] | null;
2751
+ status_reason: string | null;
2752
+ unique_artist_count: number | null;
2753
+ venue_id: string | null;
2754
+ venue_name: string | null;
2755
+ website_url: string | null;
2756
+ };
2757
+ Relationships: [
2758
+ {
2759
+ foreignKeyName: "prospect_scores_converted_lead_id_fkey";
2760
+ columns: ["converted_lead_id"];
2761
+ isOneToOne: false;
2762
+ referencedRelation: "leads";
2763
+ referencedColumns: ["id"];
2764
+ },
2765
+ {
2766
+ foreignKeyName: "prospect_scores_directory_event_id_fkey";
2767
+ columns: ["directory_event_id"];
2768
+ isOneToOne: false;
2769
+ referencedRelation: "prospect_event_directory";
2770
+ referencedColumns: ["id"];
2771
+ }
2772
+ ];
2773
+ };
2376
2774
  };
2377
2775
  Functions: {
2776
+ artist_tier_score: {
2777
+ Args: {
2778
+ p_tier: Database["core"]["Enums"]["artist_price_tier"];
2779
+ };
2780
+ Returns: number;
2781
+ };
2378
2782
  build_win_back_prefill_payload: {
2379
2783
  Args: {
2380
2784
  _client_id: string;
@@ -2392,6 +2796,14 @@ export type Database = {
2392
2796
  updated_count: number;
2393
2797
  }[];
2394
2798
  };
2799
+ bulk_upsert_directory_entries: {
2800
+ Args: {
2801
+ p_dry_run?: boolean;
2802
+ p_entries: Json;
2803
+ p_organization_id: string;
2804
+ };
2805
+ Returns: Json;
2806
+ };
2395
2807
  check_booking_gate: {
2396
2808
  Args: {
2397
2809
  _client_id: string;
@@ -2404,6 +2816,13 @@ export type Database = {
2404
2816
  };
2405
2817
  Returns: string;
2406
2818
  };
2819
+ convert_prospect_to_lead: {
2820
+ Args: {
2821
+ p_overrides?: Json;
2822
+ p_score_id: string;
2823
+ };
2824
+ Returns: string;
2825
+ };
2407
2826
  display_portal_token: {
2408
2827
  Args: {
2409
2828
  _value: string;
@@ -2470,6 +2889,21 @@ export type Database = {
2470
2889
  survey_sent_at: string;
2471
2890
  }[];
2472
2891
  };
2892
+ haversine_miles: {
2893
+ Args: {
2894
+ lat1: number;
2895
+ lat2: number;
2896
+ lng1: number;
2897
+ lng2: number;
2898
+ };
2899
+ Returns: number;
2900
+ };
2901
+ match_all_play_history: {
2902
+ Args: {
2903
+ p_organization_id: string;
2904
+ };
2905
+ Returns: number;
2906
+ };
2473
2907
  match_artists_for_bulk_pricing: {
2474
2908
  Args: {
2475
2909
  _names: string[];
@@ -2487,6 +2921,13 @@ export type Database = {
2487
2921
  matched_name: string;
2488
2922
  }[];
2489
2923
  };
2924
+ match_play_history_to_directory: {
2925
+ Args: {
2926
+ p_organization_id: string;
2927
+ p_play_history_id: string;
2928
+ };
2929
+ Returns: string;
2930
+ };
2490
2931
  normalize_contact_email: {
2491
2932
  Args: {
2492
2933
  _value: string;
@@ -2499,6 +2940,12 @@ export type Database = {
2499
2940
  };
2500
2941
  Returns: string;
2501
2942
  };
2943
+ normalize_event_name: {
2944
+ Args: {
2945
+ p_name: string;
2946
+ };
2947
+ Returns: string;
2948
+ };
2502
2949
  normalize_portal_token: {
2503
2950
  Args: {
2504
2951
  _value: string;
@@ -2518,12 +2965,30 @@ export type Database = {
2518
2965
  signer_contact_id: string;
2519
2966
  }[];
2520
2967
  };
2968
+ rebuild_routing_observations: {
2969
+ Args: {
2970
+ p_organization_id: string;
2971
+ p_year: number;
2972
+ };
2973
+ Returns: number;
2974
+ };
2521
2975
  recompute_contact_dedup_state: {
2522
2976
  Args: {
2523
2977
  _organization_id?: string;
2524
2978
  };
2525
2979
  Returns: number;
2526
2980
  };
2981
+ refresh_prospect_scores: {
2982
+ Args: {
2983
+ p_organization_id: string;
2984
+ p_year: number;
2985
+ };
2986
+ Returns: number;
2987
+ };
2988
+ refresh_prospect_scores_nightly: {
2989
+ Args: never;
2990
+ Returns: undefined;
2991
+ };
2527
2992
  resolve_service_agreement_renewal_recipients: {
2528
2993
  Args: {
2529
2994
  _client_id: string;
@@ -2546,6 +3011,40 @@ export type Database = {
2546
3011
  unresolved_assignee_roles: string[];
2547
3012
  }[];
2548
3013
  };
3014
+ review_prospect_event_match: {
3015
+ Args: {
3016
+ p_match_id: string;
3017
+ p_override_directory_event: string;
3018
+ p_status?: Database["atlas"]["Enums"]["prospect_event_match_status"];
3019
+ };
3020
+ Returns: {
3021
+ created_at: string;
3022
+ directory_event_id: string | null;
3023
+ id: string;
3024
+ match_breakdown: Json;
3025
+ match_confidence: number;
3026
+ match_status: Database["atlas"]["Enums"]["prospect_event_match_status"];
3027
+ organization_id: string;
3028
+ override_directory_event_id: string | null;
3029
+ play_history_id: string;
3030
+ reviewed_at: string | null;
3031
+ reviewed_by: string | null;
3032
+ updated_at: string;
3033
+ };
3034
+ SetofOptions: {
3035
+ from: "*";
3036
+ to: "prospect_event_matches";
3037
+ isOneToOne: true;
3038
+ isSetofReturn: false;
3039
+ };
3040
+ };
3041
+ routing_quality_band: {
3042
+ Args: {
3043
+ p_distance: number;
3044
+ p_offset_days: number;
3045
+ };
3046
+ Returns: number;
3047
+ };
2549
3048
  run_service_agreement_renewal_risk_engine: {
2550
3049
  Args: {
2551
3050
  _as_of_date?: string;
@@ -2585,6 +3084,37 @@ export type Database = {
2585
3084
  };
2586
3085
  Returns: string[];
2587
3086
  };
3087
+ set_prospect_status: {
3088
+ Args: {
3089
+ p_reason?: string;
3090
+ p_score_id: string;
3091
+ p_status: Database["atlas"]["Enums"]["prospect_status"];
3092
+ };
3093
+ Returns: {
3094
+ avg_distance_miles: number | null;
3095
+ computed_at: string;
3096
+ converted_lead_id: string | null;
3097
+ directory_event_id: string;
3098
+ final_score: number;
3099
+ id: string;
3100
+ organization_id: string;
3101
+ reg_overlap_count: number;
3102
+ repeat_year_count: number;
3103
+ score_breakdown: Json;
3104
+ scored_for_year: number;
3105
+ status: Database["atlas"]["Enums"]["prospect_status"];
3106
+ status_changed_at: string | null;
3107
+ status_changed_by: string | null;
3108
+ status_reason: string | null;
3109
+ unique_artist_count: number;
3110
+ };
3111
+ SetofOptions: {
3112
+ from: "*";
3113
+ to: "prospect_scores";
3114
+ isOneToOne: true;
3115
+ isSetofReturn: false;
3116
+ };
3117
+ };
2588
3118
  upsert_survey_response: {
2589
3119
  Args: {
2590
3120
  p_complete?: boolean;
@@ -2622,13 +3152,15 @@ export type Database = {
2622
3152
  lead_event_type: "Fair" | "Festival" | "Concert" | "Concert Series" | "Private" | "Rodeo" | "Casino" | "Club" | "Benefit" | "Theater/PAC" | "Amphitheater" | "Stadium" | "Cruise" | "Winery" | "Semi-Private" | "Various";
2623
3153
  lead_funding_verification_status: "VERIFIED" | "PENDING" | "UNVERIFIED";
2624
3154
  lead_lifecycle_status: "LEAD" | "WIN_BACK" | "VETTING" | "VPS_REVIEW" | "SA_SENT" | "SA_NEGOTIATING" | "CONVERTED" | "DECLINED" | "REFERRED_OUT";
2625
- lead_source: "TBEP_DIRECT" | "WEBSITE" | "CLIENT_REFERRAL" | "WIN_BACK_AUTOMATION";
3155
+ lead_source: "TBEP_DIRECT" | "WEBSITE" | "CLIENT_REFERRAL" | "WIN_BACK_AUTOMATION" | "ROUTING_PROSPECT_ENGINE";
2626
3156
  lead_source_type: "TBEP_DIRECT" | "WEBSITE" | "CLIENT_REFERRAL" | "WIN_BACK_AUTOMATION";
2627
3157
  leaderboard_scope: "EVENT_EDITION_YEAR" | "ROLLING_30_DAYS" | "ROLLING_90_DAYS" | "ALL_TIME";
2628
3158
  lifecycle_event_type: "STATUS_CHANGE" | "REP_CHANGE" | "SA_EXECUTED" | "SA_EXPIRED" | "SA_TERMINATED" | "BOOKING_LOCKED" | "BOOKING_UNLOCKED" | "WIN_BACK_ALERT_FIRED";
2629
3159
  note_type: "CALL" | "EMAIL" | "MEETING" | "INTERNAL" | "ISSUE" | "VPS_ESCALATION" | "REASSIGNMENT" | "MIGRATED";
2630
3160
  portal_status: "PENDING" | "APPROVED" | "SUSPENDED" | "REVOKED";
2631
3161
  promoter_profit_disposition: "FEE_OFFSET" | "CO_PRO_SPLIT";
3162
+ prospect_event_match_status: "AUTO_MATCH" | "REVIEW_QUEUE" | "UNKNOWN";
3163
+ prospect_status: "NEW" | "WATCHING" | "CONTACTED" | "CONVERTED_TO_LEAD" | "DISMISSED";
2632
3164
  rep_role: "TBEP" | "EC" | "ACCOUNT_REP" | "MARKETING_REP" | "SERVICE_REP" | "ACCOUNT_SERVICE_REP" | "PRODUCTION_REP";
2633
3165
  rfp_status: "AWARENESS" | "PREPARING" | "SUBMITTED" | "UNDER_REVIEW" | "WON" | "LOST" | "NO_BID";
2634
3166
  sa_agreement_type: "FULL_SERVICE" | "TALENT_ONLY" | "PRODUCTION_ONLY" | "CONSULTING";
@@ -4734,13 +5266,6 @@ export type Database = {
4734
5266
  subject_offer_id?: string | null;
4735
5267
  };
4736
5268
  Relationships: [
4737
- {
4738
- foreignKeyName: "ein_events_actor_user_id_fkey";
4739
- columns: ["actor_user_id"];
4740
- isOneToOne: false;
4741
- referencedRelation: "profiles";
4742
- referencedColumns: ["id"];
4743
- },
4744
5269
  {
4745
5270
  foreignKeyName: "ein_events_event_edition_id_fkey";
4746
5271
  columns: ["event_edition_id"];
@@ -6194,6 +6719,19 @@ export type Database = {
6194
6719
  };
6195
6720
  Returns: string;
6196
6721
  };
6722
+ artist_price_tier_for_artist: {
6723
+ Args: {
6724
+ p_artist_id: string;
6725
+ p_organization_id: string;
6726
+ };
6727
+ Returns: Database["core"]["Enums"]["artist_price_tier"];
6728
+ };
6729
+ artist_price_tier_from_quote: {
6730
+ Args: {
6731
+ p_quote: number;
6732
+ };
6733
+ Returns: Database["core"]["Enums"]["artist_price_tier"];
6734
+ };
6197
6735
  calculate_distance_miles: {
6198
6736
  Args: {
6199
6737
  p_lat1: number;
@@ -6548,6 +7086,7 @@ export type Database = {
6548
7086
  };
6549
7087
  Enums: {
6550
7088
  artist_genre: "hip_hop" | "rb_blues" | "rock" | "country" | "pop" | "latin_hispanic" | "edm" | "reggae_reggaeton" | "americana_folk" | "alternative" | "comedy" | "tributes" | "grounds_attraction" | "other" | "christian";
7089
+ artist_price_tier: "A" | "B" | "C" | "D";
6551
7090
  artist_tier: "headliner" | "co_headliner" | "support" | "opener" | "emerging";
6552
7091
  client_lifecycle_status: "ACTIVE" | "INACTIVE" | "AT_RISK" | "WIN_BACK" | "TERMINATED";
6553
7092
  client_tier: "A" | "B" | "C";
@@ -11836,11 +12375,14 @@ export type Database = {
11836
12375
  artist_id: string;
11837
12376
  artist_representation_id: string | null;
11838
12377
  created_at: string;
12378
+ event_edition_id: string | null;
11839
12379
  event_name_text: string | null;
11840
12380
  guarantee_cents: number | null;
11841
12381
  id: string;
11842
12382
  imported_at: string;
11843
12383
  match_method: string;
12384
+ offer_created_at: string | null;
12385
+ offer_expiration_at: string | null;
11844
12386
  organization_id: string;
11845
12387
  reg_rep_name: string | null;
11846
12388
  reg_rep_profile_id: string | null;
@@ -11856,11 +12398,14 @@ export type Database = {
11856
12398
  artist_id: string;
11857
12399
  artist_representation_id?: string | null;
11858
12400
  created_at?: string;
12401
+ event_edition_id?: string | null;
11859
12402
  event_name_text?: string | null;
11860
12403
  guarantee_cents?: number | null;
11861
12404
  id?: string;
11862
12405
  imported_at?: string;
11863
12406
  match_method?: string;
12407
+ offer_created_at?: string | null;
12408
+ offer_expiration_at?: string | null;
11864
12409
  organization_id: string;
11865
12410
  reg_rep_name?: string | null;
11866
12411
  reg_rep_profile_id?: string | null;
@@ -11876,11 +12421,14 @@ export type Database = {
11876
12421
  artist_id?: string;
11877
12422
  artist_representation_id?: string | null;
11878
12423
  created_at?: string;
12424
+ event_edition_id?: string | null;
11879
12425
  event_name_text?: string | null;
11880
12426
  guarantee_cents?: number | null;
11881
12427
  id?: string;
11882
12428
  imported_at?: string;
11883
12429
  match_method?: string;
12430
+ offer_created_at?: string | null;
12431
+ offer_expiration_at?: string | null;
11884
12432
  organization_id?: string;
11885
12433
  reg_rep_name?: string | null;
11886
12434
  reg_rep_profile_id?: string | null;
@@ -11909,6 +12457,10 @@ export type Database = {
11909
12457
  event_name_input: string | null;
11910
12458
  guarantee_cents: number | null;
11911
12459
  id: string;
12460
+ offer_created_at: string | null;
12461
+ offer_expiration_at: string | null;
12462
+ offer_last_updated_at: string | null;
12463
+ offer_status_input: string | null;
11912
12464
  organization_id: string;
11913
12465
  raw_payload: Json;
11914
12466
  reg_rep_name_input: string | null;
@@ -11917,6 +12469,8 @@ export type Database = {
11917
12469
  source: string;
11918
12470
  source_idempotency_key: string;
11919
12471
  source_year: number | null;
12472
+ venue_city_input: string | null;
12473
+ venue_state_input: string | null;
11920
12474
  };
11921
12475
  Insert: {
11922
12476
  agency_name_input?: string | null;
@@ -11925,6 +12479,10 @@ export type Database = {
11925
12479
  event_name_input?: string | null;
11926
12480
  guarantee_cents?: number | null;
11927
12481
  id?: string;
12482
+ offer_created_at?: string | null;
12483
+ offer_expiration_at?: string | null;
12484
+ offer_last_updated_at?: string | null;
12485
+ offer_status_input?: string | null;
11928
12486
  organization_id: string;
11929
12487
  raw_payload: Json;
11930
12488
  reg_rep_name_input?: string | null;
@@ -11933,6 +12491,8 @@ export type Database = {
11933
12491
  source: string;
11934
12492
  source_idempotency_key: string;
11935
12493
  source_year?: number | null;
12494
+ venue_city_input?: string | null;
12495
+ venue_state_input?: string | null;
11936
12496
  };
11937
12497
  Update: {
11938
12498
  agency_name_input?: string | null;
@@ -11941,6 +12501,10 @@ export type Database = {
11941
12501
  event_name_input?: string | null;
11942
12502
  guarantee_cents?: number | null;
11943
12503
  id?: string;
12504
+ offer_created_at?: string | null;
12505
+ offer_expiration_at?: string | null;
12506
+ offer_last_updated_at?: string | null;
12507
+ offer_status_input?: string | null;
11944
12508
  organization_id?: string;
11945
12509
  raw_payload?: Json;
11946
12510
  reg_rep_name_input?: string | null;
@@ -11949,6 +12513,8 @@ export type Database = {
11949
12513
  source?: string;
11950
12514
  source_idempotency_key?: string;
11951
12515
  source_year?: number | null;
12516
+ venue_city_input?: string | null;
12517
+ venue_state_input?: string | null;
11952
12518
  };
11953
12519
  Relationships: [];
11954
12520
  };
@@ -12061,6 +12627,51 @@ export type Database = {
12061
12627
  }
12062
12628
  ];
12063
12629
  };
12630
+ auto_created_canonical_audit: {
12631
+ Row: {
12632
+ created_at: string;
12633
+ entity_id: string;
12634
+ entity_type: string;
12635
+ id: string;
12636
+ inputs: Json;
12637
+ organization_id: string;
12638
+ review_outcome: string | null;
12639
+ reviewed_at: string | null;
12640
+ reviewed_by_user_id: string | null;
12641
+ source: string;
12642
+ source_idempotency_key: string | null;
12643
+ triggering_unresolved_id: string | null;
12644
+ };
12645
+ Insert: {
12646
+ created_at?: string;
12647
+ entity_id: string;
12648
+ entity_type: string;
12649
+ id?: string;
12650
+ inputs: Json;
12651
+ organization_id: string;
12652
+ review_outcome?: string | null;
12653
+ reviewed_at?: string | null;
12654
+ reviewed_by_user_id?: string | null;
12655
+ source: string;
12656
+ source_idempotency_key?: string | null;
12657
+ triggering_unresolved_id?: string | null;
12658
+ };
12659
+ Update: {
12660
+ created_at?: string;
12661
+ entity_id?: string;
12662
+ entity_type?: string;
12663
+ id?: string;
12664
+ inputs?: Json;
12665
+ organization_id?: string;
12666
+ review_outcome?: string | null;
12667
+ reviewed_at?: string | null;
12668
+ reviewed_by_user_id?: string | null;
12669
+ source?: string;
12670
+ source_idempotency_key?: string | null;
12671
+ triggering_unresolved_id?: string | null;
12672
+ };
12673
+ Relationships: [];
12674
+ };
12064
12675
  pollstar_fetch_queue: {
12065
12676
  Row: {
12066
12677
  artist_id: string;
@@ -12206,6 +12817,50 @@ export type Database = {
12206
12817
  };
12207
12818
  };
12208
12819
  Functions: {
12820
+ _find_event_series_for_org: {
12821
+ Args: {
12822
+ _name: string;
12823
+ _organization_id: string;
12824
+ };
12825
+ Returns: string;
12826
+ };
12827
+ _resolve_or_create_venue: {
12828
+ Args: {
12829
+ _city: string;
12830
+ _organization_id: string;
12831
+ _state: string;
12832
+ };
12833
+ Returns: string;
12834
+ };
12835
+ _state_aliases: {
12836
+ Args: {
12837
+ _state: string;
12838
+ };
12839
+ Returns: string[];
12840
+ };
12841
+ auto_resolve_unresolved_offer: {
12842
+ Args: {
12843
+ _unresolved_id: string;
12844
+ };
12845
+ Returns: Json;
12846
+ };
12847
+ bulk_ingest_inactive_clients: {
12848
+ Args: {
12849
+ p_organization_id: string;
12850
+ p_rows: Json;
12851
+ p_source: string;
12852
+ };
12853
+ Returns: Json;
12854
+ };
12855
+ bulk_ingest_unresolved_offers: {
12856
+ Args: {
12857
+ p_organization_id: string;
12858
+ p_rows: Json;
12859
+ p_source: string;
12860
+ p_source_year: number;
12861
+ };
12862
+ Returns: Json;
12863
+ };
12209
12864
  consume_api_budget: {
12210
12865
  Args: {
12211
12866
  _api_source: string;
@@ -12213,6 +12868,16 @@ export type Database = {
12213
12868
  };
12214
12869
  Returns: number;
12215
12870
  };
12871
+ create_event_series_and_resolve: {
12872
+ Args: {
12873
+ p_client_id: string;
12874
+ p_match_event_name?: string;
12875
+ p_organization_id: string;
12876
+ p_series_name: string;
12877
+ p_unresolved_ids?: string[];
12878
+ };
12879
+ Returns: Json;
12880
+ };
12216
12881
  current_pollstar_tier_ceiling: {
12217
12882
  Args: {
12218
12883
  _api_source?: string;
@@ -12241,6 +12906,12 @@ export type Database = {
12241
12906
  };
12242
12907
  Returns: string;
12243
12908
  };
12909
+ ensure_event_edition_for_unresolved: {
12910
+ Args: {
12911
+ _unresolved_id: string;
12912
+ };
12913
+ Returns: Json;
12914
+ };
12244
12915
  is_artist_eligible_for_sync: {
12245
12916
  Args: {
12246
12917
  _api_source: string;
@@ -12248,6 +12919,25 @@ export type Database = {
12248
12919
  };
12249
12920
  Returns: boolean;
12250
12921
  };
12922
+ list_unresolved_offer_groups: {
12923
+ Args: {
12924
+ p_organization_id: string;
12925
+ };
12926
+ Returns: {
12927
+ earliest_show_date: string;
12928
+ event_name_input: string;
12929
+ example_unresolved_id: string;
12930
+ group_key: string;
12931
+ has_matching_series: boolean;
12932
+ latest_show_date: string;
12933
+ row_count: number;
12934
+ status_breakdown: Json;
12935
+ top_series_candidate: string;
12936
+ top_series_id: string;
12937
+ venue_city_input: string;
12938
+ venue_state_input: string;
12939
+ }[];
12940
+ };
12251
12941
  reclassify_artist_genre: {
12252
12942
  Args: {
12253
12943
  _artist_id: string;
@@ -12281,6 +12971,13 @@ export type Database = {
12281
12971
  _unresolved_id: string;
12282
12972
  };
12283
12973
  Returns: string;
12974
+ } | {
12975
+ Args: {
12976
+ _artist_id: string;
12977
+ _event_edition_id?: string;
12978
+ _unresolved_id: string;
12979
+ };
12980
+ Returns: string;
12284
12981
  };
12285
12982
  suggest_artists_for_unresolved: {
12286
12983
  Args: {
@@ -12293,6 +12990,26 @@ export type Database = {
12293
12990
  similarity: number;
12294
12991
  }[];
12295
12992
  };
12993
+ suggest_event_edition_for_unresolved: {
12994
+ Args: {
12995
+ _unresolved_id: string;
12996
+ };
12997
+ Returns: {
12998
+ city: string;
12999
+ city_match: number;
13000
+ combined_score: number;
13001
+ date_in_range: number;
13002
+ edition_name: string;
13003
+ end_date: string;
13004
+ event_edition_id: string;
13005
+ location_score: number;
13006
+ name_match: number;
13007
+ series_name: string;
13008
+ start_date: string;
13009
+ state: string;
13010
+ state_match: number;
13011
+ }[];
13012
+ };
12296
13013
  upsert_artist_market_performance: {
12297
13014
  Args: {
12298
13015
  _artist_id: string;
@@ -12952,6 +13669,84 @@ export type Database = {
12952
13669
  }
12953
13670
  ];
12954
13671
  };
13672
+ buyer_event_edition_rollups: {
13673
+ Row: {
13674
+ add_on_attach_rate: number;
13675
+ average_order_value: number;
13676
+ average_tickets_per_buyer: number;
13677
+ camping_attach_rate: number;
13678
+ created_at: string;
13679
+ edition_year: number;
13680
+ event_edition_id: string;
13681
+ event_series_id: string;
13682
+ id: string;
13683
+ lapsed_buyers_count: number;
13684
+ new_buyers_count: number;
13685
+ organization_id: string;
13686
+ payment_plan_adoption_rate: number;
13687
+ premium_tier_mix: number;
13688
+ prior_year_buyer_return_rate: number;
13689
+ refund_rate: number;
13690
+ returning_buyers_count: number;
13691
+ updated_at: string;
13692
+ };
13693
+ Insert: {
13694
+ add_on_attach_rate?: number;
13695
+ average_order_value?: number;
13696
+ average_tickets_per_buyer?: number;
13697
+ camping_attach_rate?: number;
13698
+ created_at?: string;
13699
+ edition_year?: number;
13700
+ event_edition_id: string;
13701
+ event_series_id: string;
13702
+ id?: string;
13703
+ lapsed_buyers_count?: number;
13704
+ new_buyers_count?: number;
13705
+ organization_id: string;
13706
+ payment_plan_adoption_rate?: number;
13707
+ premium_tier_mix?: number;
13708
+ prior_year_buyer_return_rate?: number;
13709
+ refund_rate?: number;
13710
+ returning_buyers_count?: number;
13711
+ updated_at?: string;
13712
+ };
13713
+ Update: {
13714
+ add_on_attach_rate?: number;
13715
+ average_order_value?: number;
13716
+ average_tickets_per_buyer?: number;
13717
+ camping_attach_rate?: number;
13718
+ created_at?: string;
13719
+ edition_year?: number;
13720
+ event_edition_id?: string;
13721
+ event_series_id?: string;
13722
+ id?: string;
13723
+ lapsed_buyers_count?: number;
13724
+ new_buyers_count?: number;
13725
+ organization_id?: string;
13726
+ payment_plan_adoption_rate?: number;
13727
+ premium_tier_mix?: number;
13728
+ prior_year_buyer_return_rate?: number;
13729
+ refund_rate?: number;
13730
+ returning_buyers_count?: number;
13731
+ updated_at?: string;
13732
+ };
13733
+ Relationships: [
13734
+ {
13735
+ foreignKeyName: "buyer_event_edition_rollups_event_edition_id_fkey";
13736
+ columns: ["event_edition_id"];
13737
+ isOneToOne: false;
13738
+ referencedRelation: "event_intelligence_projection";
13739
+ referencedColumns: ["event_edition_id"];
13740
+ },
13741
+ {
13742
+ foreignKeyName: "buyer_event_edition_rollups_event_series_id_fkey";
13743
+ columns: ["event_series_id"];
13744
+ isOneToOne: false;
13745
+ referencedRelation: "event_intelligence_projection";
13746
+ referencedColumns: ["event_series_id"];
13747
+ }
13748
+ ];
13749
+ };
12955
13750
  buyer_event_links: {
12956
13751
  Row: {
12957
13752
  add_on_types: string[];
@@ -13168,6 +13963,97 @@ export type Database = {
13168
13963
  };
13169
13964
  Relationships: [];
13170
13965
  };
13966
+ buyer_year_over_year_rollups: {
13967
+ Row: {
13968
+ add_on_purchase_count: number;
13969
+ buyer_identity_id: string;
13970
+ consecutive_years_attended: number;
13971
+ created_at: string;
13972
+ event_edition_id: string;
13973
+ event_series_id: string;
13974
+ first_purchase_year: number;
13975
+ id: string;
13976
+ most_recent_purchase_year: number;
13977
+ organization_id: string;
13978
+ payment_plan_usage_count: number;
13979
+ premium_purchase_count: number;
13980
+ prior_year_attendee: boolean;
13981
+ refunded_order_count: number;
13982
+ total_lifetime_camping_purchases: number;
13983
+ total_lifetime_orders: number;
13984
+ total_lifetime_revenue: number;
13985
+ total_lifetime_tickets: number;
13986
+ updated_at: string;
13987
+ years_attended_count: number;
13988
+ };
13989
+ Insert: {
13990
+ add_on_purchase_count?: number;
13991
+ buyer_identity_id: string;
13992
+ consecutive_years_attended?: number;
13993
+ created_at?: string;
13994
+ event_edition_id: string;
13995
+ event_series_id: string;
13996
+ first_purchase_year?: number;
13997
+ id?: string;
13998
+ most_recent_purchase_year?: number;
13999
+ organization_id: string;
14000
+ payment_plan_usage_count?: number;
14001
+ premium_purchase_count?: number;
14002
+ prior_year_attendee?: boolean;
14003
+ refunded_order_count?: number;
14004
+ total_lifetime_camping_purchases?: number;
14005
+ total_lifetime_orders?: number;
14006
+ total_lifetime_revenue?: number;
14007
+ total_lifetime_tickets?: number;
14008
+ updated_at?: string;
14009
+ years_attended_count?: number;
14010
+ };
14011
+ Update: {
14012
+ add_on_purchase_count?: number;
14013
+ buyer_identity_id?: string;
14014
+ consecutive_years_attended?: number;
14015
+ created_at?: string;
14016
+ event_edition_id?: string;
14017
+ event_series_id?: string;
14018
+ first_purchase_year?: number;
14019
+ id?: string;
14020
+ most_recent_purchase_year?: number;
14021
+ organization_id?: string;
14022
+ payment_plan_usage_count?: number;
14023
+ premium_purchase_count?: number;
14024
+ prior_year_attendee?: boolean;
14025
+ refunded_order_count?: number;
14026
+ total_lifetime_camping_purchases?: number;
14027
+ total_lifetime_orders?: number;
14028
+ total_lifetime_revenue?: number;
14029
+ total_lifetime_tickets?: number;
14030
+ updated_at?: string;
14031
+ years_attended_count?: number;
14032
+ };
14033
+ Relationships: [
14034
+ {
14035
+ foreignKeyName: "buyer_year_over_year_rollups_buyer_identity_id_fkey";
14036
+ columns: ["buyer_identity_id"];
14037
+ isOneToOne: false;
14038
+ referencedRelation: "buyer_identities";
14039
+ referencedColumns: ["id"];
14040
+ },
14041
+ {
14042
+ foreignKeyName: "buyer_year_over_year_rollups_event_edition_id_fkey";
14043
+ columns: ["event_edition_id"];
14044
+ isOneToOne: false;
14045
+ referencedRelation: "event_intelligence_projection";
14046
+ referencedColumns: ["event_edition_id"];
14047
+ },
14048
+ {
14049
+ foreignKeyName: "buyer_year_over_year_rollups_event_series_id_fkey";
14050
+ columns: ["event_series_id"];
14051
+ isOneToOne: false;
14052
+ referencedRelation: "event_intelligence_projection";
14053
+ referencedColumns: ["event_series_id"];
14054
+ }
14055
+ ];
14056
+ };
13171
14057
  demand_simulations: {
13172
14058
  Row: {
13173
14059
  attendance_delta_pct: number | null;
@@ -13977,6 +14863,176 @@ export type Database = {
13977
14863
  };
13978
14864
  Relationships: [];
13979
14865
  };
14866
+ ticket_import_jobs: {
14867
+ Row: {
14868
+ completed_at: string | null;
14869
+ created_at: string;
14870
+ duplicate_buyer_event_links_count: number;
14871
+ error_message: string | null;
14872
+ event_edition_id: string;
14873
+ file_name: string;
14874
+ file_type: string;
14875
+ id: string;
14876
+ inferred_mappings_json: Json | null;
14877
+ invalid_rows: number;
14878
+ mapping_json: Json | null;
14879
+ matched_buyer_identities_count: number;
14880
+ new_buyer_event_links_count: number;
14881
+ new_buyer_identities_count: number;
14882
+ normalization_warnings_json: Json | null;
14883
+ organization_id: string;
14884
+ parse_warnings_json: Json | null;
14885
+ source_config_json: Json | null;
14886
+ source_field_availability_json: Json | null;
14887
+ source_type: string;
14888
+ started_at: string | null;
14889
+ total_rows: number;
14890
+ updated_at: string;
14891
+ upload_status: string;
14892
+ uploaded_by_user_id: string | null;
14893
+ valid_rows: number;
14894
+ };
14895
+ Insert: {
14896
+ completed_at?: string | null;
14897
+ created_at?: string;
14898
+ duplicate_buyer_event_links_count?: number;
14899
+ error_message?: string | null;
14900
+ event_edition_id: string;
14901
+ file_name?: string;
14902
+ file_type?: string;
14903
+ id?: string;
14904
+ inferred_mappings_json?: Json | null;
14905
+ invalid_rows?: number;
14906
+ mapping_json?: Json | null;
14907
+ matched_buyer_identities_count?: number;
14908
+ new_buyer_event_links_count?: number;
14909
+ new_buyer_identities_count?: number;
14910
+ normalization_warnings_json?: Json | null;
14911
+ organization_id: string;
14912
+ parse_warnings_json?: Json | null;
14913
+ source_config_json?: Json | null;
14914
+ source_field_availability_json?: Json | null;
14915
+ source_type?: string;
14916
+ started_at?: string | null;
14917
+ total_rows?: number;
14918
+ updated_at?: string;
14919
+ upload_status?: string;
14920
+ uploaded_by_user_id?: string | null;
14921
+ valid_rows?: number;
14922
+ };
14923
+ Update: {
14924
+ completed_at?: string | null;
14925
+ created_at?: string;
14926
+ duplicate_buyer_event_links_count?: number;
14927
+ error_message?: string | null;
14928
+ event_edition_id?: string;
14929
+ file_name?: string;
14930
+ file_type?: string;
14931
+ id?: string;
14932
+ inferred_mappings_json?: Json | null;
14933
+ invalid_rows?: number;
14934
+ mapping_json?: Json | null;
14935
+ matched_buyer_identities_count?: number;
14936
+ new_buyer_event_links_count?: number;
14937
+ new_buyer_identities_count?: number;
14938
+ normalization_warnings_json?: Json | null;
14939
+ organization_id?: string;
14940
+ parse_warnings_json?: Json | null;
14941
+ source_config_json?: Json | null;
14942
+ source_field_availability_json?: Json | null;
14943
+ source_type?: string;
14944
+ started_at?: string | null;
14945
+ total_rows?: number;
14946
+ updated_at?: string;
14947
+ upload_status?: string;
14948
+ uploaded_by_user_id?: string | null;
14949
+ valid_rows?: number;
14950
+ };
14951
+ Relationships: [
14952
+ {
14953
+ foreignKeyName: "ticket_import_jobs_event_edition_id_fkey";
14954
+ columns: ["event_edition_id"];
14955
+ isOneToOne: false;
14956
+ referencedRelation: "event_intelligence_projection";
14957
+ referencedColumns: ["event_edition_id"];
14958
+ }
14959
+ ];
14960
+ };
14961
+ ticket_import_rows: {
14962
+ Row: {
14963
+ analytical_outcome: string | null;
14964
+ created_at: string;
14965
+ dedupe_hash: string | null;
14966
+ event_edition_id: string;
14967
+ id: string;
14968
+ import_job_id: string;
14969
+ normalized_payload_json: Json | null;
14970
+ organization_id: string;
14971
+ processing_outcome: string | null;
14972
+ purchase_timestamp: string | null;
14973
+ purchaser_email: string | null;
14974
+ raw_payload_json: Json | null;
14975
+ row_fingerprint: string | null;
14976
+ source_field_presence_json: Json | null;
14977
+ source_row_number: number;
14978
+ validation_errors_json: Json | null;
14979
+ validation_status: string;
14980
+ };
14981
+ Insert: {
14982
+ analytical_outcome?: string | null;
14983
+ created_at?: string;
14984
+ dedupe_hash?: string | null;
14985
+ event_edition_id: string;
14986
+ id?: string;
14987
+ import_job_id: string;
14988
+ normalized_payload_json?: Json | null;
14989
+ organization_id: string;
14990
+ processing_outcome?: string | null;
14991
+ purchase_timestamp?: string | null;
14992
+ purchaser_email?: string | null;
14993
+ raw_payload_json?: Json | null;
14994
+ row_fingerprint?: string | null;
14995
+ source_field_presence_json?: Json | null;
14996
+ source_row_number?: number;
14997
+ validation_errors_json?: Json | null;
14998
+ validation_status?: string;
14999
+ };
15000
+ Update: {
15001
+ analytical_outcome?: string | null;
15002
+ created_at?: string;
15003
+ dedupe_hash?: string | null;
15004
+ event_edition_id?: string;
15005
+ id?: string;
15006
+ import_job_id?: string;
15007
+ normalized_payload_json?: Json | null;
15008
+ organization_id?: string;
15009
+ processing_outcome?: string | null;
15010
+ purchase_timestamp?: string | null;
15011
+ purchaser_email?: string | null;
15012
+ raw_payload_json?: Json | null;
15013
+ row_fingerprint?: string | null;
15014
+ source_field_presence_json?: Json | null;
15015
+ source_row_number?: number;
15016
+ validation_errors_json?: Json | null;
15017
+ validation_status?: string;
15018
+ };
15019
+ Relationships: [
15020
+ {
15021
+ foreignKeyName: "ticket_import_rows_event_edition_id_fkey";
15022
+ columns: ["event_edition_id"];
15023
+ isOneToOne: false;
15024
+ referencedRelation: "event_intelligence_projection";
15025
+ referencedColumns: ["event_edition_id"];
15026
+ },
15027
+ {
15028
+ foreignKeyName: "ticket_import_rows_import_job_id_fkey";
15029
+ columns: ["import_job_id"];
15030
+ isOneToOne: false;
15031
+ referencedRelation: "ticket_import_jobs";
15032
+ referencedColumns: ["id"];
15033
+ }
15034
+ ];
15035
+ };
13980
15036
  ticket_pace_snapshots: {
13981
15037
  Row: {
13982
15038
  anomaly_detail: string | null;
@@ -14193,6 +15249,20 @@ export type Database = {
14193
15249
  };
14194
15250
  Returns: Json;
14195
15251
  };
15252
+ execute_ticket_import: {
15253
+ Args: {
15254
+ p_caller_user_id: string;
15255
+ p_event_edition_id: string;
15256
+ p_invalid_rows: number;
15257
+ p_is_final_chunk?: boolean;
15258
+ p_job_id: string;
15259
+ p_organization_id: string;
15260
+ p_rows: Json;
15261
+ p_total_rows: number;
15262
+ p_valid_rows: number;
15263
+ };
15264
+ Returns: Json;
15265
+ };
14196
15266
  finalize_activation_export: {
14197
15267
  Args: {
14198
15268
  p_delivered_count?: number;
@@ -14210,12 +15280,32 @@ export type Database = {
14210
15280
  };
14211
15281
  Returns: boolean;
14212
15282
  };
15283
+ list_engine_schedules: {
15284
+ Args: never;
15285
+ Returns: {
15286
+ active: boolean;
15287
+ command: string;
15288
+ failed_24h: number;
15289
+ jobname: string;
15290
+ last_duration_ms: number;
15291
+ last_run: string;
15292
+ last_status: string;
15293
+ schedule: string;
15294
+ succeeded_24h: number;
15295
+ }[];
15296
+ };
14213
15297
  poll_launchpad_lineup_consumer: {
14214
15298
  Args: {
14215
15299
  p_batch_size?: number;
14216
15300
  };
14217
15301
  Returns: Json;
14218
15302
  };
15303
+ rebuild_buyer_rollups_for_edition: {
15304
+ Args: {
15305
+ p_event_edition_id: string;
15306
+ };
15307
+ Returns: Json;
15308
+ };
14219
15309
  refresh_demand_signals: {
14220
15310
  Args: {
14221
15311
  p_artist_ids?: string[];
@@ -15081,6 +16171,17 @@ export type Database = {
15081
16171
  Row: {
15082
16172
  artist_id: string;
15083
16173
  event_date: string;
16174
+ external_city: string | null;
16175
+ external_confidence_score: number | null;
16176
+ external_event_end_date: string | null;
16177
+ external_event_name: string | null;
16178
+ external_event_start_date: string | null;
16179
+ external_event_type: string | null;
16180
+ external_event_url: string | null;
16181
+ external_promoter_name: string | null;
16182
+ external_source: string | null;
16183
+ external_state: string | null;
16184
+ external_venue_name: string | null;
15084
16185
  id: string;
15085
16186
  market_id: string | null;
15086
16187
  organization_id: string;
@@ -15091,6 +16192,17 @@ export type Database = {
15091
16192
  Insert: {
15092
16193
  artist_id: string;
15093
16194
  event_date: string;
16195
+ external_city?: string | null;
16196
+ external_confidence_score?: number | null;
16197
+ external_event_end_date?: string | null;
16198
+ external_event_name?: string | null;
16199
+ external_event_start_date?: string | null;
16200
+ external_event_type?: string | null;
16201
+ external_event_url?: string | null;
16202
+ external_promoter_name?: string | null;
16203
+ external_source?: string | null;
16204
+ external_state?: string | null;
16205
+ external_venue_name?: string | null;
15094
16206
  id?: string;
15095
16207
  market_id?: string | null;
15096
16208
  organization_id: string;
@@ -15101,6 +16213,17 @@ export type Database = {
15101
16213
  Update: {
15102
16214
  artist_id?: string;
15103
16215
  event_date?: string;
16216
+ external_city?: string | null;
16217
+ external_confidence_score?: number | null;
16218
+ external_event_end_date?: string | null;
16219
+ external_event_name?: string | null;
16220
+ external_event_start_date?: string | null;
16221
+ external_event_type?: string | null;
16222
+ external_event_url?: string | null;
16223
+ external_promoter_name?: string | null;
16224
+ external_source?: string | null;
16225
+ external_state?: string | null;
16226
+ external_venue_name?: string | null;
15104
16227
  id?: string;
15105
16228
  market_id?: string | null;
15106
16229
  organization_id?: string;
@@ -17898,6 +19021,13 @@ export type Database = {
17898
19021
  };
17899
19022
  };
17900
19023
  Functions: {
19024
+ consume_booking_offer_context_events: {
19025
+ Args: {
19026
+ _consumer_name?: string;
19027
+ _limit?: number;
19028
+ };
19029
+ Returns: Json;
19030
+ };
17901
19031
  count_matching_artists: {
17902
19032
  Args: {
17903
19033
  p_active_only?: boolean;
@@ -18917,13 +20047,15 @@ export declare const Constants: {
18917
20047
  readonly lead_event_type: readonly ["Fair", "Festival", "Concert", "Concert Series", "Private", "Rodeo", "Casino", "Club", "Benefit", "Theater/PAC", "Amphitheater", "Stadium", "Cruise", "Winery", "Semi-Private", "Various"];
18918
20048
  readonly lead_funding_verification_status: readonly ["VERIFIED", "PENDING", "UNVERIFIED"];
18919
20049
  readonly lead_lifecycle_status: readonly ["LEAD", "WIN_BACK", "VETTING", "VPS_REVIEW", "SA_SENT", "SA_NEGOTIATING", "CONVERTED", "DECLINED", "REFERRED_OUT"];
18920
- readonly lead_source: readonly ["TBEP_DIRECT", "WEBSITE", "CLIENT_REFERRAL", "WIN_BACK_AUTOMATION"];
20050
+ readonly lead_source: readonly ["TBEP_DIRECT", "WEBSITE", "CLIENT_REFERRAL", "WIN_BACK_AUTOMATION", "ROUTING_PROSPECT_ENGINE"];
18921
20051
  readonly lead_source_type: readonly ["TBEP_DIRECT", "WEBSITE", "CLIENT_REFERRAL", "WIN_BACK_AUTOMATION"];
18922
20052
  readonly leaderboard_scope: readonly ["EVENT_EDITION_YEAR", "ROLLING_30_DAYS", "ROLLING_90_DAYS", "ALL_TIME"];
18923
20053
  readonly lifecycle_event_type: readonly ["STATUS_CHANGE", "REP_CHANGE", "SA_EXECUTED", "SA_EXPIRED", "SA_TERMINATED", "BOOKING_LOCKED", "BOOKING_UNLOCKED", "WIN_BACK_ALERT_FIRED"];
18924
20054
  readonly note_type: readonly ["CALL", "EMAIL", "MEETING", "INTERNAL", "ISSUE", "VPS_ESCALATION", "REASSIGNMENT", "MIGRATED"];
18925
20055
  readonly portal_status: readonly ["PENDING", "APPROVED", "SUSPENDED", "REVOKED"];
18926
20056
  readonly promoter_profit_disposition: readonly ["FEE_OFFSET", "CO_PRO_SPLIT"];
20057
+ readonly prospect_event_match_status: readonly ["AUTO_MATCH", "REVIEW_QUEUE", "UNKNOWN"];
20058
+ readonly prospect_status: readonly ["NEW", "WATCHING", "CONTACTED", "CONVERTED_TO_LEAD", "DISMISSED"];
18927
20059
  readonly rep_role: readonly ["TBEP", "EC", "ACCOUNT_REP", "MARKETING_REP", "SERVICE_REP", "ACCOUNT_SERVICE_REP", "PRODUCTION_REP"];
18928
20060
  readonly rfp_status: readonly ["AWARENESS", "PREPARING", "SUBMITTED", "UNDER_REVIEW", "WON", "LOST", "NO_BID"];
18929
20061
  readonly sa_agreement_type: readonly ["FULL_SERVICE", "TALENT_ONLY", "PRODUCTION_ONLY", "CONSULTING"];
@@ -18952,6 +20084,7 @@ export declare const Constants: {
18952
20084
  readonly core: {
18953
20085
  readonly Enums: {
18954
20086
  readonly artist_genre: readonly ["hip_hop", "rb_blues", "rock", "country", "pop", "latin_hispanic", "edm", "reggae_reggaeton", "americana_folk", "alternative", "comedy", "tributes", "grounds_attraction", "other", "christian"];
20087
+ readonly artist_price_tier: readonly ["A", "B", "C", "D"];
18955
20088
  readonly artist_tier: readonly ["headliner", "co_headliner", "support", "opener", "emerging"];
18956
20089
  readonly client_lifecycle_status: readonly ["ACTIVE", "INACTIVE", "AT_RISK", "WIN_BACK", "TERMINATED"];
18957
20090
  readonly client_tier: readonly ["A", "B", "C"];