diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts index 4c75f05..8e099a6 100644 --- a/src/integrations/supabase/types.ts +++ b/src/integrations/supabase/types.ts @@ -39,6 +39,259 @@ export type Database = { } public: { Tables: { + applicant_documents: { + Row: { + applicant_id: string + created_at: string + document_type: string | null + file_path: string + id: string + title: string | null + uploaded_by: string | null + } + Insert: { + applicant_id: string + created_at?: string + document_type?: string | null + file_path: string + id?: string + title?: string | null + uploaded_by?: string | null + } + Update: { + applicant_id?: string + created_at?: string + document_type?: string | null + file_path?: string + id?: string + title?: string | null + uploaded_by?: string | null + } + Relationships: [ + { + foreignKeyName: "applicant_documents_applicant_id_fkey" + columns: ["applicant_id"] + isOneToOne: false + referencedRelation: "applicants" + referencedColumns: ["id"] + }, + ] + } + applicant_notes: { + Row: { + applicant_id: string + author_id: string | null + body: string + created_at: string + id: string + is_confidential: boolean + } + Insert: { + applicant_id: string + author_id?: string | null + body: string + created_at?: string + id?: string + is_confidential?: boolean + } + Update: { + applicant_id?: string + author_id?: string | null + body?: string + created_at?: string + id?: string + is_confidential?: boolean + } + Relationships: [ + { + foreignKeyName: "applicant_notes_applicant_id_fkey" + columns: ["applicant_id"] + isOneToOne: false + referencedRelation: "applicants" + referencedColumns: ["id"] + }, + ] + } + applicant_stage_history: { + Row: { + applicant_id: string + changed_at: string + changed_by: string | null + from_stage_id: string | null + id: string + note: string | null + to_stage_id: string | null + } + Insert: { + applicant_id: string + changed_at?: string + changed_by?: string | null + from_stage_id?: string | null + id?: string + note?: string | null + to_stage_id?: string | null + } + Update: { + applicant_id?: string + changed_at?: string + changed_by?: string | null + from_stage_id?: string | null + id?: string + note?: string | null + to_stage_id?: string | null + } + Relationships: [ + { + foreignKeyName: "applicant_stage_history_applicant_id_fkey" + columns: ["applicant_id"] + isOneToOne: false + referencedRelation: "applicants" + referencedColumns: ["id"] + }, + { + foreignKeyName: "applicant_stage_history_from_stage_id_fkey" + columns: ["from_stage_id"] + isOneToOne: false + referencedRelation: "applicant_stages" + referencedColumns: ["id"] + }, + { + foreignKeyName: "applicant_stage_history_to_stage_id_fkey" + columns: ["to_stage_id"] + isOneToOne: false + referencedRelation: "applicant_stages" + referencedColumns: ["id"] + }, + ] + } + applicant_stages: { + Row: { + created_at: string + id: string + is_active: boolean + is_terminal: boolean + name: string + slug: string + sort_order: number + } + Insert: { + created_at?: string + id?: string + is_active?: boolean + is_terminal?: boolean + name: string + slug: string + sort_order?: number + } + Update: { + created_at?: string + id?: string + is_active?: boolean + is_terminal?: boolean + name?: string + slug?: string + sort_order?: number + } + Relationships: [] + } + applicants: { + Row: { + applied_on: string + campus_id: string | null + created_at: string + created_by: string | null + desired_pay_cents: number | null + desired_start_date: string | null + email: string | null + first_name: string + hired_on: string | null + hired_user_id: string | null + id: string + is_active: boolean + last_name: string + phone: string | null + position_applied: string + rating: number | null + resume_path: string | null + source: string | null + stage_id: string | null + updated_at: string + } + Insert: { + applied_on?: string + campus_id?: string | null + created_at?: string + created_by?: string | null + desired_pay_cents?: number | null + desired_start_date?: string | null + email?: string | null + first_name: string + hired_on?: string | null + hired_user_id?: string | null + id?: string + is_active?: boolean + last_name: string + phone?: string | null + position_applied: string + rating?: number | null + resume_path?: string | null + source?: string | null + stage_id?: string | null + updated_at?: string + } + Update: { + applied_on?: string + campus_id?: string | null + created_at?: string + created_by?: string | null + desired_pay_cents?: number | null + desired_start_date?: string | null + email?: string | null + first_name?: string + hired_on?: string | null + hired_user_id?: string | null + id?: string + is_active?: boolean + last_name?: string + phone?: string | null + position_applied?: string + rating?: number | null + resume_path?: string | null + source?: string | null + stage_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "applicants_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "applicants_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "applicants_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + { + foreignKeyName: "applicants_stage_id_fkey" + columns: ["stage_id"] + isOneToOne: false + referencedRelation: "applicant_stages" + referencedColumns: ["id"] + }, + ] + } assignments: { Row: { category_id: string | null @@ -123,18 +376,64 @@ export type Database = { referencedRelation: "students" referencedColumns: ["id"] }, + { + foreignKeyName: "attendance_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, ] } + audit_log: { + Row: { + action: string + actor_id: string | null + changed_columns: string[] | null + id: number + new_data: Json | null + occurred_at: string + old_data: Json | null + record_id: string | null + table_name: string + } + Insert: { + action: string + actor_id?: string | null + changed_columns?: string[] | null + id?: never + new_data?: Json | null + occurred_at?: string + old_data?: Json | null + record_id?: string | null + table_name: string + } + Update: { + action?: string + actor_id?: string | null + changed_columns?: string[] | null + id?: never + new_data?: Json | null + occurred_at?: string + old_data?: Json | null + record_id?: string | null + table_name?: string + } + Relationships: [] + } authorized_pickups: { Row: { alt_phone: string | null created_at: string id: string + is_authorized: boolean kind: string name: string notes: string | null + parenting_plan_id: string | null phone: string | null relationship: string | null + restriction_reason: string | null sort_order: number student_id: string } @@ -142,11 +441,14 @@ export type Database = { alt_phone?: string | null created_at?: string id?: string + is_authorized?: boolean kind?: string name: string notes?: string | null + parenting_plan_id?: string | null phone?: string | null relationship?: string | null + restriction_reason?: string | null sort_order?: number student_id: string } @@ -154,15 +456,25 @@ export type Database = { alt_phone?: string | null created_at?: string id?: string + is_authorized?: boolean kind?: string name?: string notes?: string | null + parenting_plan_id?: string | null phone?: string | null relationship?: string | null + restriction_reason?: string | null sort_order?: number student_id?: string } Relationships: [ + { + foreignKeyName: "authorized_pickups_parenting_plan_id_fkey" + columns: ["parenting_plan_id"] + isOneToOne: false + referencedRelation: "parenting_plans" + referencedColumns: ["id"] + }, { foreignKeyName: "authorized_pickups_student_id_fkey" columns: ["student_id"] @@ -170,35 +482,314 @@ export type Database = { referencedRelation: "students" referencedColumns: ["id"] }, + { + foreignKeyName: "authorized_pickups_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, ] } + billing_settings: { + Row: { + default_due_days: number + early_dropoff_fee_cents: number + id: boolean + invoice_number_prefix: string + late_pickup_fee_cents: number + legacy_attendance_autocharge: boolean + updated_at: string + } + Insert: { + default_due_days?: number + early_dropoff_fee_cents?: number + id?: boolean + invoice_number_prefix?: string + late_pickup_fee_cents?: number + legacy_attendance_autocharge?: boolean + updated_at?: string + } + Update: { + default_due_days?: number + early_dropoff_fee_cents?: number + id?: boolean + invoice_number_prefix?: string + late_pickup_fee_cents?: number + legacy_attendance_autocharge?: boolean + updated_at?: string + } + Relationships: [] + } calendar_events: { Row: { + all_day: boolean + campus_id: string | null created_at: string created_by: string | null date: string description: string | null end_date: string | null + end_time: string | null + event_type: string id: string + is_admin_only: boolean + start_time: string | null title: string + visible_to_roles: Database["public"]["Enums"]["app_role"][] } Insert: { + all_day?: boolean + campus_id?: string | null created_at?: string created_by?: string | null date: string description?: string | null end_date?: string | null + end_time?: string | null + event_type?: string id?: string + is_admin_only?: boolean + start_time?: string | null title: string + visible_to_roles?: Database["public"]["Enums"]["app_role"][] } Update: { + all_day?: boolean + campus_id?: string | null created_at?: string created_by?: string | null date?: string description?: string | null end_date?: string | null + end_time?: string | null + event_type?: string id?: string + is_admin_only?: boolean + start_time?: string | null title?: string + visible_to_roles?: Database["public"]["Enums"]["app_role"][] + } + Relationships: [ + { + foreignKeyName: "calendar_events_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "calendar_events_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "calendar_events_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + ] + } + campus_programs: { + Row: { + campus_id: string + created_at: string + description: string | null + id: string + is_active: boolean + max_age_months: number | null + min_age_months: number | null + name: string + } + Insert: { + campus_id: string + created_at?: string + description?: string | null + id?: string + is_active?: boolean + max_age_months?: number | null + min_age_months?: number | null + name: string + } + Update: { + campus_id?: string + created_at?: string + description?: string | null + id?: string + is_active?: boolean + max_age_months?: number | null + min_age_months?: number | null + name?: string + } + Relationships: [ + { + foreignKeyName: "campus_programs_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "campus_programs_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "campus_programs_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + ] + } + campuses: { + Row: { + campus_type: string | null + code: string | null + created_at: string + created_by: string | null + early_dropoff_time: string | null + email: string | null + grade_levels_served: string[] + id: string + is_active: boolean + late_pickup_cutoff: string | null + mailing_city: string | null + mailing_country: string | null + mailing_postal_code: string | null + mailing_state: string | null + mailing_street1: string | null + mailing_street2: string | null + max_age_months: number | null + min_age_months: number | null + name: string + notes: string | null + operating_hours: Json + phone: string | null + physical_city: string | null + physical_country: string + physical_postal_code: string | null + physical_state: string | null + physical_street1: string | null + physical_street2: string | null + standard_dismissal_time: string | null + standard_start_time: string | null + student_capacity: number | null + timezone: string + updated_at: string + } + Insert: { + campus_type?: string | null + code?: string | null + created_at?: string + created_by?: string | null + early_dropoff_time?: string | null + email?: string | null + grade_levels_served?: string[] + id?: string + is_active?: boolean + late_pickup_cutoff?: string | null + mailing_city?: string | null + mailing_country?: string | null + mailing_postal_code?: string | null + mailing_state?: string | null + mailing_street1?: string | null + mailing_street2?: string | null + max_age_months?: number | null + min_age_months?: number | null + name: string + notes?: string | null + operating_hours?: Json + phone?: string | null + physical_city?: string | null + physical_country?: string + physical_postal_code?: string | null + physical_state?: string | null + physical_street1?: string | null + physical_street2?: string | null + standard_dismissal_time?: string | null + standard_start_time?: string | null + student_capacity?: number | null + timezone?: string + updated_at?: string + } + Update: { + campus_type?: string | null + code?: string | null + created_at?: string + created_by?: string | null + early_dropoff_time?: string | null + email?: string | null + grade_levels_served?: string[] + id?: string + is_active?: boolean + late_pickup_cutoff?: string | null + mailing_city?: string | null + mailing_country?: string | null + mailing_postal_code?: string | null + mailing_state?: string | null + mailing_street1?: string | null + mailing_street2?: string | null + max_age_months?: number | null + min_age_months?: number | null + name?: string + notes?: string | null + operating_hours?: Json + phone?: string | null + physical_city?: string | null + physical_country?: string + physical_postal_code?: string | null + physical_state?: string | null + physical_street1?: string | null + physical_street2?: string | null + standard_dismissal_time?: string | null + standard_start_time?: string | null + student_capacity?: number | null + timezone?: string + updated_at?: string + } + Relationships: [] + } + certification_types: { + Row: { + created_at: string + description: string | null + id: string + is_active: boolean + issuing_body: string | null + name: string + renewal_reminder_days: number + slug: string + validity_months: number | null + } + Insert: { + created_at?: string + description?: string | null + id?: string + is_active?: boolean + issuing_body?: string | null + name: string + renewal_reminder_days?: number + slug: string + validity_months?: number | null + } + Update: { + created_at?: string + description?: string | null + id?: string + is_active?: boolean + issuing_body?: string | null + name?: string + renewal_reminder_days?: number + slug?: string + validity_months?: number | null } Relationships: [] } @@ -223,6 +814,68 @@ export type Database = { } Relationships: [] } + compliance_requirements: { + Row: { + applies_to_roles: Database["public"]["Enums"]["app_role"][] + campus_id: string | null + certification_type_id: string + created_at: string + grace_period_days: number + id: string + is_mandatory: boolean + notes: string | null + } + Insert: { + applies_to_roles?: Database["public"]["Enums"]["app_role"][] + campus_id?: string | null + certification_type_id: string + created_at?: string + grace_period_days?: number + id?: string + is_mandatory?: boolean + notes?: string | null + } + Update: { + applies_to_roles?: Database["public"]["Enums"]["app_role"][] + campus_id?: string | null + certification_type_id?: string + created_at?: string + grace_period_days?: number + id?: string + is_mandatory?: boolean + notes?: string | null + } + Relationships: [ + { + foreignKeyName: "compliance_requirements_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "compliance_requirements_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "compliance_requirements_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + { + foreignKeyName: "compliance_requirements_certification_type_id_fkey" + columns: ["certification_type_id"] + isOneToOne: false + referencedRelation: "certification_types" + referencedColumns: ["id"] + }, + ] + } contracts: { Row: { created_at: string @@ -256,8 +909,54 @@ export type Database = { referencedRelation: "students" referencedColumns: ["id"] }, + { + foreignKeyName: "contracts_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, ] } + deletion_requests: { + Row: { + id: string + reason: string + record_id: string + requested_at: string + requested_by: string | null + review_note: string | null + reviewed_at: string | null + reviewed_by: string | null + status: string + table_name: string + } + Insert: { + id?: string + reason: string + record_id: string + requested_at?: string + requested_by?: string | null + review_note?: string | null + reviewed_at?: string | null + reviewed_by?: string | null + status?: string + table_name: string + } + Update: { + id?: string + reason?: string + record_id?: string + requested_at?: string + requested_by?: string | null + review_note?: string | null + reviewed_at?: string | null + reviewed_by?: string | null + status?: string + table_name?: string + } + Relationships: [] + } form_responses: { Row: { data_json: Json @@ -298,6 +997,13 @@ export type Database = { referencedRelation: "students" referencedColumns: ["id"] }, + { + foreignKeyName: "form_responses_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, ] } forms: { @@ -437,8 +1143,256 @@ export type Database = { referencedRelation: "students" referencedColumns: ["id"] }, + { + foreignKeyName: "grades_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, ] } + household_member_contacts: { + Row: { + created_at: string + id: string + is_primary: boolean + kind: string + label: string | null + member_id: string + value: string + } + Insert: { + created_at?: string + id?: string + is_primary?: boolean + kind: string + label?: string | null + member_id: string + value: string + } + Update: { + created_at?: string + id?: string + is_primary?: boolean + kind?: string + label?: string | null + member_id?: string + value?: string + } + Relationships: [ + { + foreignKeyName: "household_member_contacts_member_id_fkey" + columns: ["member_id"] + isOneToOne: false + referencedRelation: "household_members" + referencedColumns: ["id"] + }, + ] + } + household_members: { + Row: { + billing_share_percent: number | null + can_pick_up: boolean + can_view_records: boolean + city: string | null + communication_allowed: boolean + created_at: string + emergency_priority: number | null + first_name: string + household_id: string + id: string + is_billing_responsible: boolean + is_emergency_contact: boolean + last_name: string + notes: string | null + postal_code: string | null + preferred_contact_method: string + receives_invoices: boolean + relationship: string | null + restricted_record_categories: string[] + state: string | null + street1: string | null + street2: string | null + updated_at: string + user_id: string | null + } + Insert: { + billing_share_percent?: number | null + can_pick_up?: boolean + can_view_records?: boolean + city?: string | null + communication_allowed?: boolean + created_at?: string + emergency_priority?: number | null + first_name: string + household_id: string + id?: string + is_billing_responsible?: boolean + is_emergency_contact?: boolean + last_name: string + notes?: string | null + postal_code?: string | null + preferred_contact_method?: string + receives_invoices?: boolean + relationship?: string | null + restricted_record_categories?: string[] + state?: string | null + street1?: string | null + street2?: string | null + updated_at?: string + user_id?: string | null + } + Update: { + billing_share_percent?: number | null + can_pick_up?: boolean + can_view_records?: boolean + city?: string | null + communication_allowed?: boolean + created_at?: string + emergency_priority?: number | null + first_name?: string + household_id?: string + id?: string + is_billing_responsible?: boolean + is_emergency_contact?: boolean + last_name?: string + notes?: string | null + postal_code?: string | null + preferred_contact_method?: string + receives_invoices?: boolean + relationship?: string | null + restricted_record_categories?: string[] + state?: string | null + street1?: string | null + street2?: string | null + updated_at?: string + user_id?: string | null + } + Relationships: [ + { + foreignKeyName: "household_members_household_id_fkey" + columns: ["household_id"] + isOneToOne: false + referencedRelation: "households" + referencedColumns: ["id"] + }, + { + foreignKeyName: "household_members_household_id_fkey" + columns: ["household_id"] + isOneToOne: false + referencedRelation: "v_household_balances" + referencedColumns: ["household_id"] + }, + ] + } + household_students: { + Row: { + created_at: string + household_id: string + id: string + is_primary_household: boolean + student_id: string + } + Insert: { + created_at?: string + household_id: string + id?: string + is_primary_household?: boolean + student_id: string + } + Update: { + created_at?: string + household_id?: string + id?: string + is_primary_household?: boolean + student_id?: string + } + Relationships: [ + { + foreignKeyName: "household_students_household_id_fkey" + columns: ["household_id"] + isOneToOne: false + referencedRelation: "households" + referencedColumns: ["id"] + }, + { + foreignKeyName: "household_students_household_id_fkey" + columns: ["household_id"] + isOneToOne: false + referencedRelation: "v_household_balances" + referencedColumns: ["household_id"] + }, + { + foreignKeyName: "household_students_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "household_students_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + ] + } + households: { + Row: { + billing_email: string | null + city: string | null + communicate_separately: boolean + country: string + created_at: string + created_by: string | null + id: string + name: string + notes: string | null + phone: string | null + postal_code: string | null + state: string | null + street1: string | null + street2: string | null + updated_at: string + } + Insert: { + billing_email?: string | null + city?: string | null + communicate_separately?: boolean + country?: string + created_at?: string + created_by?: string | null + id?: string + name: string + notes?: string | null + phone?: string | null + postal_code?: string | null + state?: string | null + street1?: string | null + street2?: string | null + updated_at?: string + } + Update: { + billing_email?: string | null + city?: string | null + communicate_separately?: boolean + country?: string + created_at?: string + created_by?: string | null + id?: string + name?: string + notes?: string | null + phone?: string | null + postal_code?: string | null + state?: string | null + street1?: string | null + street2?: string | null + updated_at?: string + } + Relationships: [] + } intake_tokens: { Row: { created_at: string @@ -475,6 +1429,514 @@ export type Database = { referencedRelation: "students" referencedColumns: ["id"] }, + { + foreignKeyName: "intake_tokens_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + ] + } + integration_sync_logs: { + Row: { + detail: Json + error_message: string | null + finished_at: string | null + id: number + integration_id: string + records_processed: number + started_at: string + status: string + } + Insert: { + detail?: Json + error_message?: string | null + finished_at?: string | null + id?: never + integration_id: string + records_processed?: number + started_at?: string + status?: string + } + Update: { + detail?: Json + error_message?: string | null + finished_at?: string | null + id?: never + integration_id?: string + records_processed?: number + started_at?: string + status?: string + } + Relationships: [ + { + foreignKeyName: "integration_sync_logs_integration_id_fkey" + columns: ["integration_id"] + isOneToOne: false + referencedRelation: "integrations" + referencedColumns: ["id"] + }, + ] + } + integrations: { + Row: { + campus_id: string | null + category: string + config: Json + created_at: string + created_by: string | null + credential_ref: string | null + id: string + is_active: boolean + last_sync_at: string | null + last_sync_status: string | null + name: string + provider: string + updated_at: string + } + Insert: { + campus_id?: string | null + category?: string + config?: Json + created_at?: string + created_by?: string | null + credential_ref?: string | null + id?: string + is_active?: boolean + last_sync_at?: string | null + last_sync_status?: string | null + name: string + provider: string + updated_at?: string + } + Update: { + campus_id?: string | null + category?: string + config?: Json + created_at?: string + created_by?: string | null + credential_ref?: string | null + id?: string + is_active?: boolean + last_sync_at?: string | null + last_sync_status?: string | null + name?: string + provider?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "integrations_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "integrations_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "integrations_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + ] + } + invoice_batches: { + Row: { + billing_period_end: string + billing_period_start: string + confirmed_at: string | null + confirmed_by: string | null + created_at: string + created_by: string | null + criteria: Json + id: string + name: string | null + previewed_at: string | null + previewed_by: string | null + status: string + student_count: number + total_cents: number + } + Insert: { + billing_period_end: string + billing_period_start: string + confirmed_at?: string | null + confirmed_by?: string | null + created_at?: string + created_by?: string | null + criteria?: Json + id?: string + name?: string | null + previewed_at?: string | null + previewed_by?: string | null + status?: string + student_count?: number + total_cents?: number + } + Update: { + billing_period_end?: string + billing_period_start?: string + confirmed_at?: string | null + confirmed_by?: string | null + created_at?: string + created_by?: string | null + criteria?: Json + id?: string + name?: string | null + previewed_at?: string | null + previewed_by?: string | null + status?: string + student_count?: number + total_cents?: number + } + Relationships: [] + } + invoice_documents: { + Row: { + created_at: string + file_path: string + id: string + invoice_id: string + title: string | null + uploaded_by: string | null + } + Insert: { + created_at?: string + file_path: string + id?: string + invoice_id: string + title?: string | null + uploaded_by?: string | null + } + Update: { + created_at?: string + file_path?: string + id?: string + invoice_id?: string + title?: string | null + uploaded_by?: string | null + } + Relationships: [ + { + foreignKeyName: "invoice_documents_invoice_id_fkey" + columns: ["invoice_id"] + isOneToOne: false + referencedRelation: "invoices" + referencedColumns: ["id"] + }, + { + foreignKeyName: "invoice_documents_invoice_id_fkey" + columns: ["invoice_id"] + isOneToOne: false + referencedRelation: "v_outstanding_invoices" + referencedColumns: ["invoice_id"] + }, + ] + } + invoice_line_items: { + Row: { + adjustment_rule_id: string | null + amount_cents: number + campus_id: string | null + credit_id: string | null + description: string + detail: Json + id: string + invoice_id: string + line_kind: string + quantity: number + scholarship_id: string | null + sort_order: number + tuition_rate_id: string | null + unit_amount_cents: number + } + Insert: { + adjustment_rule_id?: string | null + amount_cents: number + campus_id?: string | null + credit_id?: string | null + description: string + detail?: Json + id?: string + invoice_id: string + line_kind: string + quantity?: number + scholarship_id?: string | null + sort_order?: number + tuition_rate_id?: string | null + unit_amount_cents?: number + } + Update: { + adjustment_rule_id?: string | null + amount_cents?: number + campus_id?: string | null + credit_id?: string | null + description?: string + detail?: Json + id?: string + invoice_id?: string + line_kind?: string + quantity?: number + scholarship_id?: string | null + sort_order?: number + tuition_rate_id?: string | null + unit_amount_cents?: number + } + Relationships: [ + { + foreignKeyName: "invoice_line_items_adjustment_rule_id_fkey" + columns: ["adjustment_rule_id"] + isOneToOne: false + referencedRelation: "tuition_adjustment_rules" + referencedColumns: ["id"] + }, + { + foreignKeyName: "invoice_line_items_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "invoice_line_items_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "invoice_line_items_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + { + foreignKeyName: "invoice_line_items_credit_id_fkey" + columns: ["credit_id"] + isOneToOne: false + referencedRelation: "student_credits" + referencedColumns: ["id"] + }, + { + foreignKeyName: "invoice_line_items_invoice_id_fkey" + columns: ["invoice_id"] + isOneToOne: false + referencedRelation: "invoices" + referencedColumns: ["id"] + }, + { + foreignKeyName: "invoice_line_items_invoice_id_fkey" + columns: ["invoice_id"] + isOneToOne: false + referencedRelation: "v_outstanding_invoices" + referencedColumns: ["invoice_id"] + }, + { + foreignKeyName: "invoice_line_items_scholarship_id_fkey" + columns: ["scholarship_id"] + isOneToOne: false + referencedRelation: "scholarships" + referencedColumns: ["id"] + }, + { + foreignKeyName: "invoice_line_items_tuition_rate_id_fkey" + columns: ["tuition_rate_id"] + isOneToOne: false + referencedRelation: "tuition_rates" + referencedColumns: ["id"] + }, + ] + } + invoices: { + Row: { + amount_paid_cents: number + attendance_basis: string | null + balance_due_cents: number | null + batch_id: string | null + billing_period_end: string + billing_period_start: string + calculation_log: Json + campus_id: string | null + created_at: string + credits_cents: number + discounts_cents: number + due_date: string + household_id: string | null + id: string + invoice_date: string + invoice_number: string + issued_at: string | null + issued_by: string | null + notes: string | null + payment_plan_id: string | null + payment_type: string | null + penalties_cents: number + requires_signature: boolean + scheduled_days: number | null + scholarship_cents: number + signature_data: string | null + signed_at: string | null + signed_by: string | null + status: string + student_id: string + subtotal_cents: number + total_cents: number + tuition_tier_id: string | null + updated_at: string + } + Insert: { + amount_paid_cents?: number + attendance_basis?: string | null + balance_due_cents?: number | null + batch_id?: string | null + billing_period_end: string + billing_period_start: string + calculation_log?: Json + campus_id?: string | null + created_at?: string + credits_cents?: number + discounts_cents?: number + due_date?: string + household_id?: string | null + id?: string + invoice_date?: string + invoice_number: string + issued_at?: string | null + issued_by?: string | null + notes?: string | null + payment_plan_id?: string | null + payment_type?: string | null + penalties_cents?: number + requires_signature?: boolean + scheduled_days?: number | null + scholarship_cents?: number + signature_data?: string | null + signed_at?: string | null + signed_by?: string | null + status?: string + student_id: string + subtotal_cents?: number + total_cents?: number + tuition_tier_id?: string | null + updated_at?: string + } + Update: { + amount_paid_cents?: number + attendance_basis?: string | null + balance_due_cents?: number | null + batch_id?: string | null + billing_period_end?: string + billing_period_start?: string + calculation_log?: Json + campus_id?: string | null + created_at?: string + credits_cents?: number + discounts_cents?: number + due_date?: string + household_id?: string | null + id?: string + invoice_date?: string + invoice_number?: string + issued_at?: string | null + issued_by?: string | null + notes?: string | null + payment_plan_id?: string | null + payment_type?: string | null + penalties_cents?: number + requires_signature?: boolean + scheduled_days?: number | null + scholarship_cents?: number + signature_data?: string | null + signed_at?: string | null + signed_by?: string | null + status?: string + student_id?: string + subtotal_cents?: number + total_cents?: number + tuition_tier_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "invoices_batch_fk" + columns: ["batch_id"] + isOneToOne: false + referencedRelation: "invoice_batches" + referencedColumns: ["id"] + }, + { + foreignKeyName: "invoices_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "invoices_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "invoices_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + { + foreignKeyName: "invoices_household_id_fkey" + columns: ["household_id"] + isOneToOne: false + referencedRelation: "households" + referencedColumns: ["id"] + }, + { + foreignKeyName: "invoices_household_id_fkey" + columns: ["household_id"] + isOneToOne: false + referencedRelation: "v_household_balances" + referencedColumns: ["household_id"] + }, + { + foreignKeyName: "invoices_payment_plan_id_fkey" + columns: ["payment_plan_id"] + isOneToOne: false + referencedRelation: "payment_plans" + referencedColumns: ["id"] + }, + { + foreignKeyName: "invoices_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "invoices_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + { + foreignKeyName: "invoices_tuition_tier_id_fkey" + columns: ["tuition_tier_id"] + isOneToOne: false + referencedRelation: "tuition_tiers" + referencedColumns: ["id"] + }, ] } ledger_entries: { @@ -529,6 +1991,13 @@ export type Database = { referencedRelation: "students" referencedColumns: ["id"] }, + { + foreignKeyName: "ledger_entries_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, ] } mail_server_settings: { @@ -600,6 +2069,13 @@ export type Database = { referencedRelation: "students" referencedColumns: ["id"] }, + { + foreignKeyName: "message_threads_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, ] } messages: { @@ -634,6 +2110,42 @@ export type Database = { }, ] } + note_categories: { + Row: { + created_at: string + default_visible_to_roles: Database["public"]["Enums"]["app_role"][] + description: string | null + id: string + is_active: boolean + is_confidential: boolean + name: string + slug: string + sort_order: number + } + Insert: { + created_at?: string + default_visible_to_roles?: Database["public"]["Enums"]["app_role"][] + description?: string | null + id?: string + is_active?: boolean + is_confidential?: boolean + name: string + slug: string + sort_order?: number + } + Update: { + created_at?: string + default_visible_to_roles?: Database["public"]["Enums"]["app_role"][] + description?: string | null + id?: string + is_active?: boolean + is_confidential?: boolean + name?: string + slug?: string + sort_order?: number + } + Relationships: [] + } parent_students: { Row: { created_at: string @@ -664,6 +2176,179 @@ export type Database = { referencedRelation: "students" referencedColumns: ["id"] }, + { + foreignKeyName: "parent_students_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + ] + } + parenting_plans: { + Row: { + created_at: string + created_by: string | null + description: string | null + document_path: string | null + effective_date: string + expiration_date: string | null + household_id: string | null + id: string + is_court_ordered: boolean + restricts_billing: boolean + restricts_communication: boolean + restricts_pickup: boolean + restricts_record_access: boolean + student_id: string + title: string + updated_at: string + } + Insert: { + created_at?: string + created_by?: string | null + description?: string | null + document_path?: string | null + effective_date?: string + expiration_date?: string | null + household_id?: string | null + id?: string + is_court_ordered?: boolean + restricts_billing?: boolean + restricts_communication?: boolean + restricts_pickup?: boolean + restricts_record_access?: boolean + student_id: string + title: string + updated_at?: string + } + Update: { + created_at?: string + created_by?: string | null + description?: string | null + document_path?: string | null + effective_date?: string + expiration_date?: string | null + household_id?: string | null + id?: string + is_court_ordered?: boolean + restricts_billing?: boolean + restricts_communication?: boolean + restricts_pickup?: boolean + restricts_record_access?: boolean + student_id?: string + title?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "parenting_plans_household_id_fkey" + columns: ["household_id"] + isOneToOne: false + referencedRelation: "households" + referencedColumns: ["id"] + }, + { + foreignKeyName: "parenting_plans_household_id_fkey" + columns: ["household_id"] + isOneToOne: false + referencedRelation: "v_household_balances" + referencedColumns: ["household_id"] + }, + { + foreignKeyName: "parenting_plans_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "parenting_plans_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + ] + } + payment_plans: { + Row: { + created_at: string + created_by: string | null + day_of_period: number | null + end_date: string | null + frequency: string + household_id: string | null + id: string + installment_amount_cents: number + name: string + notes: string | null + start_date: string + status: string + student_id: string | null + updated_at: string + } + Insert: { + created_at?: string + created_by?: string | null + day_of_period?: number | null + end_date?: string | null + frequency?: string + household_id?: string | null + id?: string + installment_amount_cents: number + name: string + notes?: string | null + start_date?: string + status?: string + student_id?: string | null + updated_at?: string + } + Update: { + created_at?: string + created_by?: string | null + day_of_period?: number | null + end_date?: string | null + frequency?: string + household_id?: string | null + id?: string + installment_amount_cents?: number + name?: string + notes?: string | null + start_date?: string + status?: string + student_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "payment_plans_household_id_fkey" + columns: ["household_id"] + isOneToOne: false + referencedRelation: "households" + referencedColumns: ["id"] + }, + { + foreignKeyName: "payment_plans_household_id_fkey" + columns: ["household_id"] + isOneToOne: false + referencedRelation: "v_household_balances" + referencedColumns: ["household_id"] + }, + { + foreignKeyName: "payment_plans_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "payment_plans_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, ] } plan_accommodations: { @@ -1045,6 +2730,587 @@ export type Database = { } Relationships: [] } + reminders: { + Row: { + body: string | null + channel: string + created_at: string + created_by: string | null + dismissed_at: string | null + id: string + related_certification_id: string | null + related_invoice_id: string | null + related_student_id: string | null + remind_at: string + sent_at: string | null + task_id: string | null + title: string + user_id: string + } + Insert: { + body?: string | null + channel?: string + created_at?: string + created_by?: string | null + dismissed_at?: string | null + id?: string + related_certification_id?: string | null + related_invoice_id?: string | null + related_student_id?: string | null + remind_at: string + sent_at?: string | null + task_id?: string | null + title: string + user_id: string + } + Update: { + body?: string | null + channel?: string + created_at?: string + created_by?: string | null + dismissed_at?: string | null + id?: string + related_certification_id?: string | null + related_invoice_id?: string | null + related_student_id?: string | null + remind_at?: string + sent_at?: string | null + task_id?: string | null + title?: string + user_id?: string + } + Relationships: [ + { + foreignKeyName: "reminders_related_certification_id_fkey" + columns: ["related_certification_id"] + isOneToOne: false + referencedRelation: "staff_certifications" + referencedColumns: ["id"] + }, + { + foreignKeyName: "reminders_related_certification_id_fkey" + columns: ["related_certification_id"] + isOneToOne: false + referencedRelation: "v_certification_expiry" + referencedColumns: ["certification_id"] + }, + { + foreignKeyName: "reminders_related_invoice_id_fkey" + columns: ["related_invoice_id"] + isOneToOne: false + referencedRelation: "invoices" + referencedColumns: ["id"] + }, + { + foreignKeyName: "reminders_related_invoice_id_fkey" + columns: ["related_invoice_id"] + isOneToOne: false + referencedRelation: "v_outstanding_invoices" + referencedColumns: ["invoice_id"] + }, + { + foreignKeyName: "reminders_related_student_id_fkey" + columns: ["related_student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "reminders_related_student_id_fkey" + columns: ["related_student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + { + foreignKeyName: "reminders_task_id_fkey" + columns: ["task_id"] + isOneToOne: false + referencedRelation: "tasks" + referencedColumns: ["id"] + }, + { + foreignKeyName: "reminders_task_id_fkey" + columns: ["task_id"] + isOneToOne: false + referencedRelation: "v_open_tasks" + referencedColumns: ["task_id"] + }, + ] + } + scholarships: { + Row: { + award_amount_cents: number + created_at: string + created_by: string | null + document_path: string | null + external_reference: string | null + frequency: string + funding_period_end: string | null + funding_period_start: string + id: string + notes: string | null + program_name: string + status: string + student_id: string + updated_at: string + } + Insert: { + award_amount_cents: number + created_at?: string + created_by?: string | null + document_path?: string | null + external_reference?: string | null + frequency?: string + funding_period_end?: string | null + funding_period_start?: string + id?: string + notes?: string | null + program_name?: string + status?: string + student_id: string + updated_at?: string + } + Update: { + award_amount_cents?: number + created_at?: string + created_by?: string | null + document_path?: string | null + external_reference?: string | null + frequency?: string + funding_period_end?: string | null + funding_period_start?: string + id?: string + notes?: string | null + program_name?: string + status?: string + student_id?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "scholarships_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "scholarships_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + ] + } + staff_campus_assignments: { + Row: { + campus_id: string + created_at: string + end_date: string | null + id: string + is_primary: boolean + start_date: string | null + title: string | null + user_id: string + } + Insert: { + campus_id: string + created_at?: string + end_date?: string | null + id?: string + is_primary?: boolean + start_date?: string | null + title?: string | null + user_id: string + } + Update: { + campus_id?: string + created_at?: string + end_date?: string | null + id?: string + is_primary?: boolean + start_date?: string | null + title?: string | null + user_id?: string + } + Relationships: [ + { + foreignKeyName: "staff_campus_assignments_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "staff_campus_assignments_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "staff_campus_assignments_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + ] + } + staff_certifications: { + Row: { + certificate_number: string | null + certification_type_id: string + created_at: string + document_path: string | null + expires_on: string | null + id: string + issued_on: string | null + notes: string | null + status: string + updated_at: string + user_id: string + verified_at: string | null + verified_by: string | null + } + Insert: { + certificate_number?: string | null + certification_type_id: string + created_at?: string + document_path?: string | null + expires_on?: string | null + id?: string + issued_on?: string | null + notes?: string | null + status?: string + updated_at?: string + user_id: string + verified_at?: string | null + verified_by?: string | null + } + Update: { + certificate_number?: string | null + certification_type_id?: string + created_at?: string + document_path?: string | null + expires_on?: string | null + id?: string + issued_on?: string | null + notes?: string | null + status?: string + updated_at?: string + user_id?: string + verified_at?: string | null + verified_by?: string | null + } + Relationships: [ + { + foreignKeyName: "staff_certifications_certification_type_id_fkey" + columns: ["certification_type_id"] + isOneToOne: false + referencedRelation: "certification_types" + referencedColumns: ["id"] + }, + ] + } + student_alert_acknowledgments: { + Row: { + acknowledged_at: string + alert_id: string + id: string + note: string | null + user_id: string + } + Insert: { + acknowledged_at?: string + alert_id: string + id?: string + note?: string | null + user_id: string + } + Update: { + acknowledged_at?: string + alert_id?: string + id?: string + note?: string | null + user_id?: string + } + Relationships: [ + { + foreignKeyName: "student_alert_acknowledgments_alert_id_fkey" + columns: ["alert_id"] + isOneToOne: false + referencedRelation: "student_alerts" + referencedColumns: ["id"] + }, + ] + } + student_alert_views: { + Row: { + alert_id: string + id: string + user_id: string + viewed_at: string + } + Insert: { + alert_id: string + id?: string + user_id: string + viewed_at?: string + } + Update: { + alert_id?: string + id?: string + user_id?: string + viewed_at?: string + } + Relationships: [ + { + foreignKeyName: "student_alert_views_alert_id_fkey" + columns: ["alert_id"] + isOneToOne: false + referencedRelation: "student_alerts" + referencedColumns: ["id"] + }, + ] + } + student_alerts: { + Row: { + alert_type: string + created_at: string + created_by: string | null + description: string + document_path: string | null + effective_date: string + expiration_date: string | null + id: string + is_active: boolean + parenting_plan_id: string | null + requires_acknowledgment: boolean + severity: string + student_id: string + title: string + updated_at: string + visible_to_roles: Database["public"]["Enums"]["app_role"][] + } + Insert: { + alert_type: string + created_at?: string + created_by?: string | null + description: string + document_path?: string | null + effective_date?: string + expiration_date?: string | null + id?: string + is_active?: boolean + parenting_plan_id?: string | null + requires_acknowledgment?: boolean + severity?: string + student_id: string + title: string + updated_at?: string + visible_to_roles?: Database["public"]["Enums"]["app_role"][] + } + Update: { + alert_type?: string + created_at?: string + created_by?: string | null + description?: string + document_path?: string | null + effective_date?: string + expiration_date?: string | null + id?: string + is_active?: boolean + parenting_plan_id?: string | null + requires_acknowledgment?: boolean + severity?: string + student_id?: string + title?: string + updated_at?: string + visible_to_roles?: Database["public"]["Enums"]["app_role"][] + } + Relationships: [ + { + foreignKeyName: "student_alerts_parenting_plan_id_fkey" + columns: ["parenting_plan_id"] + isOneToOne: false + referencedRelation: "parenting_plans" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_alerts_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_alerts_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + ] + } + student_campus_schedules: { + Row: { + assignment_type: string + campus_id: string + created_at: string + created_by: string | null + early_dropoff: boolean + effective_end: string | null + effective_start: string + friday: boolean + id: string + late_pickup: boolean + monday: boolean + notes: string | null + saturday: boolean + scheduled_days_per_week: number | null + student_id: string + sunday: boolean + thursday: boolean + tuesday: boolean + updated_at: string + wednesday: boolean + } + Insert: { + assignment_type?: string + campus_id: string + created_at?: string + created_by?: string | null + early_dropoff?: boolean + effective_end?: string | null + effective_start?: string + friday?: boolean + id?: string + late_pickup?: boolean + monday?: boolean + notes?: string | null + saturday?: boolean + scheduled_days_per_week?: number | null + student_id: string + sunday?: boolean + thursday?: boolean + tuesday?: boolean + updated_at?: string + wednesday?: boolean + } + Update: { + assignment_type?: string + campus_id?: string + created_at?: string + created_by?: string | null + early_dropoff?: boolean + effective_end?: string | null + effective_start?: string + friday?: boolean + id?: string + late_pickup?: boolean + monday?: boolean + notes?: string | null + saturday?: boolean + scheduled_days_per_week?: number | null + student_id?: string + sunday?: boolean + thursday?: boolean + tuesday?: boolean + updated_at?: string + wednesday?: boolean + } + Relationships: [ + { + foreignKeyName: "student_campus_schedules_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_campus_schedules_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "student_campus_schedules_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + { + foreignKeyName: "student_campus_schedules_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_campus_schedules_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + ] + } + student_credits: { + Row: { + amount_applied_cents: number + amount_cents: number + expires_on: string | null + id: string + is_void: boolean + issued_at: string + issued_by: string | null + reason: string + student_id: string + } + Insert: { + amount_applied_cents?: number + amount_cents: number + expires_on?: string | null + id?: string + is_void?: boolean + issued_at?: string + issued_by?: string | null + reason: string + student_id: string + } + Update: { + amount_applied_cents?: number + amount_cents?: number + expires_on?: string | null + id?: string + is_void?: boolean + issued_at?: string + issued_by?: string | null + reason?: string + student_id?: string + } + Relationships: [ + { + foreignKeyName: "student_credits_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_credits_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + ] + } student_curriculum_logins: { Row: { created_at: string @@ -1084,6 +3350,13 @@ export type Database = { referencedRelation: "students" referencedColumns: ["id"] }, + { + foreignKeyName: "student_curriculum_logins_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, ] } student_guardians: { @@ -1140,6 +3413,225 @@ export type Database = { referencedRelation: "students" referencedColumns: ["id"] }, + { + foreignKeyName: "student_guardians_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + ] + } + student_note_attachments: { + Row: { + content_type: string | null + created_at: string + file_name: string | null + file_path: string + id: string + note_id: string + uploaded_by: string | null + } + Insert: { + content_type?: string | null + created_at?: string + file_name?: string | null + file_path: string + id?: string + note_id: string + uploaded_by?: string | null + } + Update: { + content_type?: string | null + created_at?: string + file_name?: string | null + file_path?: string + id?: string + note_id?: string + uploaded_by?: string | null + } + Relationships: [ + { + foreignKeyName: "student_note_attachments_note_id_fkey" + columns: ["note_id"] + isOneToOne: false + referencedRelation: "student_notes" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_note_attachments_note_id_fkey" + columns: ["note_id"] + isOneToOne: false + referencedRelation: "v_pending_followups" + referencedColumns: ["note_id"] + }, + ] + } + student_notes: { + Row: { + author_id: string | null + body: string + campus_id: string | null + category_id: string + created_at: string + follow_up_date: string | null + household_member_id: string | null + id: string + occurred_at: string + parent_visible: boolean + related_alert_id: string | null + related_attendance_id: string | null + related_ledger_entry_id: string | null + related_note_id: string | null + related_thread_id: string | null + resolution_status: string + resolved_at: string | null + resolved_by: string | null + student_id: string + title: string + updated_at: string + visible_to_roles: Database["public"]["Enums"]["app_role"][] + } + Insert: { + author_id?: string | null + body: string + campus_id?: string | null + category_id: string + created_at?: string + follow_up_date?: string | null + household_member_id?: string | null + id?: string + occurred_at?: string + parent_visible?: boolean + related_alert_id?: string | null + related_attendance_id?: string | null + related_ledger_entry_id?: string | null + related_note_id?: string | null + related_thread_id?: string | null + resolution_status?: string + resolved_at?: string | null + resolved_by?: string | null + student_id: string + title: string + updated_at?: string + visible_to_roles?: Database["public"]["Enums"]["app_role"][] + } + Update: { + author_id?: string | null + body?: string + campus_id?: string | null + category_id?: string + created_at?: string + follow_up_date?: string | null + household_member_id?: string | null + id?: string + occurred_at?: string + parent_visible?: boolean + related_alert_id?: string | null + related_attendance_id?: string | null + related_ledger_entry_id?: string | null + related_note_id?: string | null + related_thread_id?: string | null + resolution_status?: string + resolved_at?: string | null + resolved_by?: string | null + student_id?: string + title?: string + updated_at?: string + visible_to_roles?: Database["public"]["Enums"]["app_role"][] + } + Relationships: [ + { + foreignKeyName: "student_notes_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_notes_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "student_notes_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + { + foreignKeyName: "student_notes_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "note_categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_notes_household_member_id_fkey" + columns: ["household_member_id"] + isOneToOne: false + referencedRelation: "household_members" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_notes_related_alert_id_fkey" + columns: ["related_alert_id"] + isOneToOne: false + referencedRelation: "student_alerts" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_notes_related_attendance_id_fkey" + columns: ["related_attendance_id"] + isOneToOne: false + referencedRelation: "attendance" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_notes_related_ledger_entry_id_fkey" + columns: ["related_ledger_entry_id"] + isOneToOne: false + referencedRelation: "ledger_entries" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_notes_related_note_id_fkey" + columns: ["related_note_id"] + isOneToOne: false + referencedRelation: "student_notes" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_notes_related_note_id_fkey" + columns: ["related_note_id"] + isOneToOne: false + referencedRelation: "v_pending_followups" + referencedColumns: ["note_id"] + }, + { + foreignKeyName: "student_notes_related_thread_id_fkey" + columns: ["related_thread_id"] + isOneToOne: false + referencedRelation: "message_threads" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_notes_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_notes_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, ] } student_plans: { @@ -1193,6 +3685,188 @@ export type Database = { referencedRelation: "students" referencedColumns: ["id"] }, + { + foreignKeyName: "student_plans_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + ] + } + student_tag_assignments: { + Row: { + assigned_at: string + assigned_by: string | null + id: string + notes: string | null + student_id: string + tag_id: string + } + Insert: { + assigned_at?: string + assigned_by?: string | null + id?: string + notes?: string | null + student_id: string + tag_id: string + } + Update: { + assigned_at?: string + assigned_by?: string | null + id?: string + notes?: string | null + student_id?: string + tag_id?: string + } + Relationships: [ + { + foreignKeyName: "student_tag_assignments_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_tag_assignments_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + { + foreignKeyName: "student_tag_assignments_tag_id_fkey" + columns: ["tag_id"] + isOneToOne: false + referencedRelation: "student_tags" + referencedColumns: ["id"] + }, + ] + } + student_tags: { + Row: { + color: string | null + created_at: string + description: string | null + id: string + is_active: boolean + is_system: boolean + name: string + slug: string + sort_order: number + } + Insert: { + color?: string | null + created_at?: string + description?: string | null + id?: string + is_active?: boolean + is_system?: boolean + name: string + slug: string + sort_order?: number + } + Update: { + color?: string | null + created_at?: string + description?: string | null + id?: string + is_active?: boolean + is_system?: boolean + name?: string + slug?: string + sort_order?: number + } + Relationships: [] + } + student_tuition_assignments: { + Row: { + amount_cents: number + approved_at: string | null + approved_by: string | null + campus_id: string | null + created_at: string + created_by: string | null + document_path: string | null + end_date: string | null + frequency: string + id: string + last_modified_by: string | null + reason: string + start_date: string + student_id: string + updated_at: string + } + Insert: { + amount_cents: number + approved_at?: string | null + approved_by?: string | null + campus_id?: string | null + created_at?: string + created_by?: string | null + document_path?: string | null + end_date?: string | null + frequency?: string + id?: string + last_modified_by?: string | null + reason: string + start_date?: string + student_id: string + updated_at?: string + } + Update: { + amount_cents?: number + approved_at?: string | null + approved_by?: string | null + campus_id?: string | null + created_at?: string + created_by?: string | null + document_path?: string | null + end_date?: string | null + frequency?: string + id?: string + last_modified_by?: string | null + reason?: string + start_date?: string + student_id?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "student_tuition_assignments_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_tuition_assignments_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "student_tuition_assignments_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + { + foreignKeyName: "student_tuition_assignments_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_tuition_assignments_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, ] } students: { @@ -1200,7 +3874,9 @@ export type Database = { agreement_signed_by: string | null agreement_signed_date: string | null allergies: string | null + attendance_basis: string backup_transport_plan: string | null + calendar_basis: string chronic_conditions: string | null class_id: string | null created_at: string @@ -1210,23 +3886,33 @@ export type Database = { dismissal_methods: string[] dismissal_other: string | null dob: string | null + enrollment_end_date: string | null + enrollment_start_date: string | null + enrollment_status: string first_name: string gender: string | null grade_level: string | null home_ed_eval_due: string | null id: string interests: string | null + is_support_student: boolean last_name: string + middle_name: string | null notes: string | null other_info: string | null + payment_plan_id: string | null photo_path: string | null photo_release: boolean physician_phone: string | null portfolio_keeper: string | null + preferred_name: string | null preferred_start_date: string | null previous_schools: string | null + primary_campus_id: string | null primary_physician: string | null + program_id: string | null special_needs: string | null + tuition_tier_id: string | null updated_at: string user_id: string | null } @@ -1234,7 +3920,9 @@ export type Database = { agreement_signed_by?: string | null agreement_signed_date?: string | null allergies?: string | null + attendance_basis?: string backup_transport_plan?: string | null + calendar_basis?: string chronic_conditions?: string | null class_id?: string | null created_at?: string @@ -1244,23 +3932,33 @@ export type Database = { dismissal_methods?: string[] dismissal_other?: string | null dob?: string | null + enrollment_end_date?: string | null + enrollment_start_date?: string | null + enrollment_status?: string first_name: string gender?: string | null grade_level?: string | null home_ed_eval_due?: string | null id?: string interests?: string | null + is_support_student?: boolean last_name: string + middle_name?: string | null notes?: string | null other_info?: string | null + payment_plan_id?: string | null photo_path?: string | null photo_release?: boolean physician_phone?: string | null portfolio_keeper?: string | null + preferred_name?: string | null preferred_start_date?: string | null previous_schools?: string | null + primary_campus_id?: string | null primary_physician?: string | null + program_id?: string | null special_needs?: string | null + tuition_tier_id?: string | null updated_at?: string user_id?: string | null } @@ -1268,7 +3966,9 @@ export type Database = { agreement_signed_by?: string | null agreement_signed_date?: string | null allergies?: string | null + attendance_basis?: string backup_transport_plan?: string | null + calendar_basis?: string chronic_conditions?: string | null class_id?: string | null created_at?: string @@ -1278,23 +3978,33 @@ export type Database = { dismissal_methods?: string[] dismissal_other?: string | null dob?: string | null + enrollment_end_date?: string | null + enrollment_start_date?: string | null + enrollment_status?: string first_name?: string gender?: string | null grade_level?: string | null home_ed_eval_due?: string | null id?: string interests?: string | null + is_support_student?: boolean last_name?: string + middle_name?: string | null notes?: string | null other_info?: string | null + payment_plan_id?: string | null photo_path?: string | null photo_release?: boolean physician_phone?: string | null portfolio_keeper?: string | null + preferred_name?: string | null preferred_start_date?: string | null previous_schools?: string | null + primary_campus_id?: string | null primary_physician?: string | null + program_id?: string | null special_needs?: string | null + tuition_tier_id?: string | null updated_at?: string user_id?: string | null } @@ -1306,6 +4016,182 @@ export type Database = { referencedRelation: "classes" referencedColumns: ["id"] }, + { + foreignKeyName: "students_payment_plan_id_fkey" + columns: ["payment_plan_id"] + isOneToOne: false + referencedRelation: "payment_plans" + referencedColumns: ["id"] + }, + { + foreignKeyName: "students_primary_campus_id_fkey" + columns: ["primary_campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "students_primary_campus_id_fkey" + columns: ["primary_campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "students_primary_campus_id_fkey" + columns: ["primary_campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + { + foreignKeyName: "students_program_id_fkey" + columns: ["program_id"] + isOneToOne: false + referencedRelation: "campus_programs" + referencedColumns: ["id"] + }, + { + foreignKeyName: "students_tuition_tier_id_fkey" + columns: ["tuition_tier_id"] + isOneToOne: false + referencedRelation: "tuition_tiers" + referencedColumns: ["id"] + }, + ] + } + tasks: { + Row: { + assigned_to: string | null + campus_id: string | null + completed_at: string | null + completed_by: string | null + created_at: string + created_by: string | null + description: string | null + due_date: string | null + id: string + priority: string + related_applicant_id: string | null + related_invoice_id: string | null + related_note_id: string | null + related_student_id: string | null + status: string + title: string + updated_at: string + visible_to_roles: Database["public"]["Enums"]["app_role"][] + } + Insert: { + assigned_to?: string | null + campus_id?: string | null + completed_at?: string | null + completed_by?: string | null + created_at?: string + created_by?: string | null + description?: string | null + due_date?: string | null + id?: string + priority?: string + related_applicant_id?: string | null + related_invoice_id?: string | null + related_note_id?: string | null + related_student_id?: string | null + status?: string + title: string + updated_at?: string + visible_to_roles?: Database["public"]["Enums"]["app_role"][] + } + Update: { + assigned_to?: string | null + campus_id?: string | null + completed_at?: string | null + completed_by?: string | null + created_at?: string + created_by?: string | null + description?: string | null + due_date?: string | null + id?: string + priority?: string + related_applicant_id?: string | null + related_invoice_id?: string | null + related_note_id?: string | null + related_student_id?: string | null + status?: string + title?: string + updated_at?: string + visible_to_roles?: Database["public"]["Enums"]["app_role"][] + } + Relationships: [ + { + foreignKeyName: "tasks_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "tasks_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "tasks_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + { + foreignKeyName: "tasks_related_applicant_id_fkey" + columns: ["related_applicant_id"] + isOneToOne: false + referencedRelation: "applicants" + referencedColumns: ["id"] + }, + { + foreignKeyName: "tasks_related_invoice_id_fkey" + columns: ["related_invoice_id"] + isOneToOne: false + referencedRelation: "invoices" + referencedColumns: ["id"] + }, + { + foreignKeyName: "tasks_related_invoice_id_fkey" + columns: ["related_invoice_id"] + isOneToOne: false + referencedRelation: "v_outstanding_invoices" + referencedColumns: ["invoice_id"] + }, + { + foreignKeyName: "tasks_related_note_id_fkey" + columns: ["related_note_id"] + isOneToOne: false + referencedRelation: "student_notes" + referencedColumns: ["id"] + }, + { + foreignKeyName: "tasks_related_note_id_fkey" + columns: ["related_note_id"] + isOneToOne: false + referencedRelation: "v_pending_followups" + referencedColumns: ["note_id"] + }, + { + foreignKeyName: "tasks_related_student_id_fkey" + columns: ["related_student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "tasks_related_student_id_fkey" + columns: ["related_student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, ] } thread_participants: { @@ -1334,6 +4220,230 @@ export type Database = { }, ] } + tuition_adjustment_rules: { + Row: { + amount_basis: string + amount_cents: number | null + campus_id: string | null + created_at: string + created_by: string | null + effective_end: string | null + effective_start: string + id: string + is_active: boolean + name: string + notes: string | null + percent: number | null + priority: number + requires_support_student: boolean | null + requires_tag_slug: string | null + rule_type: string + tier_id: string | null + updated_at: string + } + Insert: { + amount_basis: string + amount_cents?: number | null + campus_id?: string | null + created_at?: string + created_by?: string | null + effective_end?: string | null + effective_start?: string + id?: string + is_active?: boolean + name: string + notes?: string | null + percent?: number | null + priority?: number + requires_support_student?: boolean | null + requires_tag_slug?: string | null + rule_type: string + tier_id?: string | null + updated_at?: string + } + Update: { + amount_basis?: string + amount_cents?: number | null + campus_id?: string | null + created_at?: string + created_by?: string | null + effective_end?: string | null + effective_start?: string + id?: string + is_active?: boolean + name?: string + notes?: string | null + percent?: number | null + priority?: number + requires_support_student?: boolean | null + requires_tag_slug?: string | null + rule_type?: string + tier_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "tuition_adjustment_rules_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "tuition_adjustment_rules_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "tuition_adjustment_rules_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + { + foreignKeyName: "tuition_adjustment_rules_tier_id_fkey" + columns: ["tier_id"] + isOneToOne: false + referencedRelation: "tuition_tiers" + referencedColumns: ["id"] + }, + ] + } + tuition_rates: { + Row: { + amount_cents: number + attendance_basis: string | null + campus_id: string | null + created_at: string + created_by: string | null + effective_end: string | null + effective_start: string + id: string + is_active: boolean + max_days: number | null + min_days: number | null + notes: string | null + priority: number + program_id: string | null + rate_basis: string + requires_scholarship: boolean | null + requires_support_student: boolean | null + tier_id: string | null + updated_at: string + } + Insert: { + amount_cents: number + attendance_basis?: string | null + campus_id?: string | null + created_at?: string + created_by?: string | null + effective_end?: string | null + effective_start?: string + id?: string + is_active?: boolean + max_days?: number | null + min_days?: number | null + notes?: string | null + priority?: number + program_id?: string | null + rate_basis: string + requires_scholarship?: boolean | null + requires_support_student?: boolean | null + tier_id?: string | null + updated_at?: string + } + Update: { + amount_cents?: number + attendance_basis?: string | null + campus_id?: string | null + created_at?: string + created_by?: string | null + effective_end?: string | null + effective_start?: string + id?: string + is_active?: boolean + max_days?: number | null + min_days?: number | null + notes?: string | null + priority?: number + program_id?: string | null + rate_basis?: string + requires_scholarship?: boolean | null + requires_support_student?: boolean | null + tier_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "tuition_rates_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "tuition_rates_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "tuition_rates_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + { + foreignKeyName: "tuition_rates_program_id_fkey" + columns: ["program_id"] + isOneToOne: false + referencedRelation: "campus_programs" + referencedColumns: ["id"] + }, + { + foreignKeyName: "tuition_rates_tier_id_fkey" + columns: ["tier_id"] + isOneToOne: false + referencedRelation: "tuition_tiers" + referencedColumns: ["id"] + }, + ] + } + tuition_tiers: { + Row: { + created_at: string + description: string | null + id: string + is_active: boolean + name: string + slug: string + sort_order: number + } + Insert: { + created_at?: string + description?: string | null + id?: string + is_active?: boolean + name: string + slug: string + sort_order?: number + } + Update: { + created_at?: string + description?: string | null + id?: string + is_active?: boolean + name?: string + slug?: string + sort_order?: number + } + Relationships: [] + } user_mailboxes: { Row: { created_at: string @@ -1393,20 +4503,394 @@ export type Database = { } } Views: { - [_ in never]: never + v_attendance_summary: { + Row: { + absent_days: number | null + attendance_rate_percent: number | null + excused_days: number | null + late_days: number | null + month: string | null + present_days: number | null + primary_campus_id: string | null + recorded_days: number | null + student_id: string | null + student_name: string | null + } + Relationships: [ + { + foreignKeyName: "attendance_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "attendance_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + { + foreignKeyName: "students_primary_campus_id_fkey" + columns: ["primary_campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "students_primary_campus_id_fkey" + columns: ["primary_campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "students_primary_campus_id_fkey" + columns: ["primary_campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + ] + } + v_campus_enrollment: { + Row: { + campus_id: string | null + campus_name: string | null + capacity_used_percent: number | null + enrolled_count: number | null + full_time_count: number | null + is_active: boolean | null + part_time_count: number | null + student_capacity: number | null + support_count: number | null + } + Relationships: [] + } + v_certification_expiry: { + Row: { + certification_id: string | null + certification_name: string | null + days_until_expiry: number | null + expires_on: string | null + expiry_state: string | null + issued_on: string | null + staff_name: string | null + status: string | null + user_id: string | null + } + Relationships: [] + } + v_household_balances: { + Row: { + balance_due_cents: number | null + household_id: string | null + household_name: string | null + invoiced_cents: number | null + paid_cents: number | null + student_count: number | null + } + Relationships: [] + } + v_open_tasks: { + Row: { + assigned_to: string | null + assigned_to_name: string | null + campus_id: string | null + campus_name: string | null + due_date: string | null + due_state: string | null + priority: string | null + related_student_id: string | null + status: string | null + task_id: string | null + title: string | null + } + Relationships: [ + { + foreignKeyName: "tasks_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "tasks_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "tasks_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + { + foreignKeyName: "tasks_related_student_id_fkey" + columns: ["related_student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "tasks_related_student_id_fkey" + columns: ["related_student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + ] + } + v_outstanding_invoices: { + Row: { + amount_paid_cents: number | null + balance_due_cents: number | null + billing_period_end: string | null + billing_period_start: string | null + campus_id: string | null + campus_name: string | null + days_overdue: number | null + due_date: string | null + household_id: string | null + invoice_date: string | null + invoice_id: string | null + invoice_number: string | null + status: string | null + student_id: string | null + student_name: string | null + total_cents: number | null + } + Relationships: [ + { + foreignKeyName: "invoices_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "invoices_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "invoices_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + { + foreignKeyName: "invoices_household_id_fkey" + columns: ["household_id"] + isOneToOne: false + referencedRelation: "households" + referencedColumns: ["id"] + }, + { + foreignKeyName: "invoices_household_id_fkey" + columns: ["household_id"] + isOneToOne: false + referencedRelation: "v_household_balances" + referencedColumns: ["household_id"] + }, + { + foreignKeyName: "invoices_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "invoices_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + ] + } + v_pending_followups: { + Row: { + author_id: string | null + campus_id: string | null + category: string | null + days_overdue: number | null + follow_up_date: string | null + note_id: string | null + resolution_status: string | null + student_id: string | null + student_name: string | null + title: string | null + } + Relationships: [ + { + foreignKeyName: "student_notes_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "campuses" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_notes_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_campus_enrollment" + referencedColumns: ["campus_id"] + }, + { + foreignKeyName: "student_notes_campus_id_fkey" + columns: ["campus_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["primary_campus_id"] + }, + { + foreignKeyName: "student_notes_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "students" + referencedColumns: ["id"] + }, + { + foreignKeyName: "student_notes_student_id_fkey" + columns: ["student_id"] + isOneToOne: false + referencedRelation: "v_student_directory" + referencedColumns: ["student_id"] + }, + ] + } + v_student_directory: { + Row: { + active_alert_count: number | null + attendance_basis: string | null + calendar_basis: string | null + dob: string | null + enrollment_status: string | null + first_name: string | null + grade_level: string | null + household_id: string | null + household_name: string | null + is_support_student: boolean | null + last_name: string | null + middle_name: string | null + preferred_name: string | null + primary_campus: string | null + primary_campus_id: string | null + scheduled_campuses: string[] | null + scheduled_days_per_week: number | null + student_id: string | null + tuition_tier: string | null + } + Relationships: [ + { + foreignKeyName: "household_students_household_id_fkey" + columns: ["household_id"] + isOneToOne: false + referencedRelation: "households" + referencedColumns: ["id"] + }, + { + foreignKeyName: "household_students_household_id_fkey" + columns: ["household_id"] + isOneToOne: false + referencedRelation: "v_household_balances" + referencedColumns: ["household_id"] + }, + ] + } } Functions: { + active_student_alerts: { + Args: { _student: string } + Returns: { + alert_type: string + created_at: string + created_by: string | null + description: string + document_path: string | null + effective_date: string + expiration_date: string | null + id: string + is_active: boolean + parenting_plan_id: string | null + requires_acknowledgment: boolean + severity: string + student_id: string + title: string + updated_at: string + visible_to_roles: Database["public"]["Enums"]["app_role"][] + }[] + SetofOptions: { + from: "*" + to: "student_alerts" + isOneToOne: false + isSetofReturn: true + } + } + can_access_student: { Args: { _student: string }; Returns: boolean } can_edit_goal: { Args: { _goal: string }; Returns: boolean } can_edit_meeting: { Args: { _meeting: string }; Returns: boolean } can_edit_plan: { Args: { _plan: string }; Returns: boolean } + can_guardian_view_category: { + Args: { _category: string; _student: string } + Returns: boolean + } + can_manage_student: { Args: { _student: string }; Returns: boolean } can_view_goal: { Args: { _goal: string }; Returns: boolean } can_view_meeting: { Args: { _meeting: string }; Returns: boolean } can_view_plan_full: { Args: { _plan: string }; Returns: boolean } can_view_plan_impl: { Args: { _plan: string }; Returns: boolean } + compute_invoice_lines: { + Args: { _from: string; _student: string; _to: string } + Returns: { + adjustment_rule_id: string + amount_cents: number + campus_id: string + credit_id: string + description: string + detail: Json + line_kind: string + quantity: number + scholarship_id: string + sort_order: number + tuition_rate_id: string + unit_amount_cents: number + }[] + } + create_invoice: { + Args: { + _batch?: string + _from: string + _status?: string + _student: string + _to: string + } + Returns: string + } + current_user_has_any_role: { + Args: { _roles: Database["public"]["Enums"]["app_role"][] } + Returns: boolean + } current_user_has_role: { Args: { _role: Database["public"]["Enums"]["app_role"] } Returns: boolean } + eligible_students_for_batch: { + Args: { _criteria: Json; _from: string; _to: string } + Returns: { + student_id: string + }[] + } + generate_invoice_batch: { Args: { _batch: string }; Returns: number } + has_campus_access: { Args: { _campus: string }; Returns: boolean } has_role: { Args: { _role: Database["public"]["Enums"]["app_role"] @@ -1414,14 +4898,164 @@ export type Database = { } Returns: boolean } + invoice_recipients: { + Args: { _student: string } + Returns: { + email: string + full_name: string + member_id: string + user_id: string + }[] + } + is_auditor: { Args: never; Returns: boolean } + is_billing_admin: { Args: never; Returns: boolean } + is_household_guardian_of: { Args: { _student: string }; Returns: boolean } + is_management: { Args: never; Returns: boolean } + is_org_admin: { Args: never; Returns: boolean } is_parent_of: { Args: { _student: string }; Returns: boolean } is_student_account: { Args: { _student: string }; Returns: boolean } + is_super_admin: { Args: never; Returns: boolean } is_thread_participant: { Args: { _thread: string }; Returns: boolean } + next_invoice_number: { Args: never; Returns: string } + preview_invoice_batch: { + Args: { _batch: string } + Returns: { + campus_name: string + scheduled_days: number + student_id: string + student_name: string + subtotal_cents: number + total_cents: number + }[] + } + resolve_tuition_override: { + Args: { _on: string; _student: string } + Returns: { + amount_cents: number + approved_at: string | null + approved_by: string | null + campus_id: string | null + created_at: string + created_by: string | null + document_path: string | null + end_date: string | null + frequency: string + id: string + last_modified_by: string | null + reason: string + start_date: string + student_id: string + updated_at: string + } + SetofOptions: { + from: "*" + to: "student_tuition_assignments" + isOneToOne: true + isSetofReturn: false + } + } + resolve_tuition_rate: { + Args: { _campus: string; _days?: number; _on: string; _student: string } + Returns: { + amount_cents: number + attendance_basis: string | null + campus_id: string | null + created_at: string + created_by: string | null + effective_end: string | null + effective_start: string + id: string + is_active: boolean + max_days: number | null + min_days: number | null + notes: string | null + priority: number + program_id: string | null + rate_basis: string + requires_scholarship: boolean | null + requires_support_student: boolean | null + tier_id: string | null + updated_at: string + } + SetofOptions: { + from: "*" + to: "tuition_rates" + isOneToOne: true + isSetofReturn: false + } + } + staff_compliance_gaps: { + Args: { _user: string } + Returns: { + campus_id: string + certification_name: string + certification_type_id: string + expires_on: string + gap_kind: string + }[] + } + student_campus_ids: { + Args: { _from?: string; _student: string; _to?: string } + Returns: string[] + } + student_has_tag: { + Args: { _slug: string; _student: string } + Returns: boolean + } + student_scheduled_days: { + Args: { _from: string; _student: string; _to: string } + Returns: { + campus_id: string + days_per_week: number + total_days: number + weeks: number + }[] + } teaches_class: { Args: { _class: string }; Returns: boolean } teaches_student: { Args: { _student: string }; Returns: boolean } + unacknowledged_alerts: { + Args: { _student: string } + Returns: { + alert_type: string + created_at: string + created_by: string | null + description: string + document_path: string | null + effective_date: string + expiration_date: string | null + id: string + is_active: boolean + parenting_plan_id: string | null + requires_acknowledgment: boolean + severity: string + student_id: string + title: string + updated_at: string + visible_to_roles: Database["public"]["Enums"]["app_role"][] + }[] + SetofOptions: { + from: "*" + to: "student_alerts" + isOneToOne: false + isSetofReturn: true + } + } + user_campus_ids: { Args: never; Returns: string[] } + user_household_ids: { Args: never; Returns: string[] } } Enums: { - app_role: "admin" | "teacher" | "parent" | "student" + app_role: + | "admin" + | "teacher" + | "parent" + | "student" + | "super_admin" + | "org_admin" + | "campus_admin" + | "management" + | "billing_admin" + | "staff" + | "auditor" attendance_status: "present" | "absent" | "late" | "excused" ledger_category: "tuition" | "late_pickup" | "activity" | "other" ledger_kind: "charge" | "payment" @@ -1570,7 +5204,19 @@ export const Constants = { }, public: { Enums: { - app_role: ["admin", "teacher", "parent", "student"], + app_role: [ + "admin", + "teacher", + "parent", + "student", + "super_admin", + "org_admin", + "campus_admin", + "management", + "billing_admin", + "staff", + "auditor", + ], attendance_status: ["present", "absent", "late", "excused"], ledger_category: ["tuition", "late_pickup", "activity", "other"], ledger_kind: ["charge", "payment"],