// Code generated by ent, DO NOT EDIT.

package migrate

import (
	"entgo.io/ent/dialect/entsql"
	"entgo.io/ent/dialect/sql/schema"
	"entgo.io/ent/schema/field"
)

var (
	// AccountsColumns holds the columns for the "accounts" table.
	AccountsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, Unique: true, Size: 64},
		{Name: "kind", Type: field.TypeEnum, Enums: []string{"local", "google", "caldav", "microsoft", "ical", "evolution"}},
		{Name: "display_name", Type: field.TypeString},
		{Name: "settings", Type: field.TypeJSON, Nullable: true},
		{Name: "needs_reauth", Type: field.TypeBool, Default: false},
		{Name: "auth_error", Type: field.TypeString, Nullable: true},
		{Name: "sync_notice", Type: field.TypeString, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
	}
	// AccountsTable holds the schema information for the "accounts" table.
	AccountsTable = &schema.Table{
		Name:       "accounts",
		Columns:    AccountsColumns,
		PrimaryKey: []*schema.Column{AccountsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "account_kind",
				Unique:  false,
				Columns: []*schema.Column{AccountsColumns[1]},
			},
		},
	}
	// CalendarsColumns holds the columns for the "calendars" table.
	CalendarsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, Unique: true, Size: 64},
		{Name: "remote_id", Type: field.TypeString},
		{Name: "name", Type: field.TypeString},
		{Name: "name_override", Type: field.TypeString, Nullable: true},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "color", Type: field.TypeString, Nullable: true},
		{Name: "time_zone", Type: field.TypeString, Nullable: true},
		{Name: "read_only", Type: field.TypeBool, Default: false},
		{Name: "hidden", Type: field.TypeBool, Default: false},
		{Name: "reminder_overrides", Type: field.TypeJSON, Nullable: true},
		{Name: "sync_token", Type: field.TypeString, Nullable: true},
		{Name: "supported_components", Type: field.TypeJSON, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "account_calendars", Type: field.TypeString, Size: 64},
	}
	// CalendarsTable holds the schema information for the "calendars" table.
	CalendarsTable = &schema.Table{
		Name:       "calendars",
		Columns:    CalendarsColumns,
		PrimaryKey: []*schema.Column{CalendarsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "calendars_accounts_calendars",
				Columns:    []*schema.Column{CalendarsColumns[14]},
				RefColumns: []*schema.Column{AccountsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "calendar_remote_id_account_calendars",
				Unique:  true,
				Columns: []*schema.Column{CalendarsColumns[1], CalendarsColumns[14]},
			},
		},
	}
	// EventsColumns holds the columns for the "events" table.
	EventsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, Unique: true, Size: 64},
		{Name: "uid", Type: field.TypeString},
		{Name: "remote_id", Type: field.TypeString, Nullable: true},
		{Name: "etag", Type: field.TypeString, Nullable: true},
		{Name: "summary", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "location", Type: field.TypeString, Nullable: true},
		{Name: "url", Type: field.TypeString, Nullable: true},
		{Name: "meeting_url", Type: field.TypeString, Nullable: true},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"confirmed", "tentative", "cancelled"}, Default: "confirmed"},
		{Name: "start", Type: field.TypeTime},
		{Name: "end", Type: field.TypeTime},
		{Name: "all_day", Type: field.TypeBool, Default: false},
		{Name: "start_tz", Type: field.TypeString, Nullable: true},
		{Name: "end_tz", Type: field.TypeString, Nullable: true},
		{Name: "recurrence", Type: field.TypeJSON, Nullable: true},
		{Name: "recurring_id", Type: field.TypeString, Nullable: true},
		{Name: "original_start", Type: field.TypeTime, Nullable: true},
		{Name: "organizer", Type: field.TypeJSON, Nullable: true},
		{Name: "attendees", Type: field.TypeJSON, Nullable: true},
		{Name: "reminders", Type: field.TypeJSON, Nullable: true},
		{Name: "categories", Type: field.TypeJSON, Nullable: true},
		{Name: "transparency", Type: field.TypeString, Nullable: true},
		{Name: "visibility", Type: field.TypeString, Nullable: true},
		{Name: "raw_ics", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "calendar_events", Type: field.TypeString, Size: 64},
	}
	// EventsTable holds the schema information for the "events" table.
	EventsTable = &schema.Table{
		Name:       "events",
		Columns:    EventsColumns,
		PrimaryKey: []*schema.Column{EventsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "events_calendars_events",
				Columns:    []*schema.Column{EventsColumns[27]},
				RefColumns: []*schema.Column{CalendarsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "event_uid_calendar_events",
				Unique:  true,
				Columns: []*schema.Column{EventsColumns[1], EventsColumns[27]},
			},
			{
				Name:    "event_start",
				Unique:  false,
				Columns: []*schema.Column{EventsColumns[10]},
			},
			{
				Name:    "event_end",
				Unique:  false,
				Columns: []*schema.Column{EventsColumns[11]},
			},
			{
				Name:    "event_exceptions",
				Unique:  false,
				Columns: []*schema.Column{EventsColumns[16]},
				Annotation: &entsql.IndexAnnotation{
					Where: "recurring_id <> ''",
				},
			},
			{
				Name:    "event_recurring_masters",
				Unique:  false,
				Columns: []*schema.Column{EventsColumns[10]},
				Annotation: &entsql.IndexAnnotation{
					Where: "recurrence IS NOT NULL",
				},
			},
		},
	}
	// InvitationStatesColumns holds the columns for the "invitation_states" table.
	InvitationStatesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "calendar_id", Type: field.TypeString},
		{Name: "uid", Type: field.TypeString},
		{Name: "event_start", Type: field.TypeTime},
		{Name: "notified_at", Type: field.TypeTime},
	}
	// InvitationStatesTable holds the schema information for the "invitation_states" table.
	InvitationStatesTable = &schema.Table{
		Name:       "invitation_states",
		Columns:    InvitationStatesColumns,
		PrimaryKey: []*schema.Column{InvitationStatesColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "invitationstate_calendar_id_uid",
				Unique:  true,
				Columns: []*schema.Column{InvitationStatesColumns[1], InvitationStatesColumns[2]},
			},
			{
				Name:    "invitationstate_event_start",
				Unique:  false,
				Columns: []*schema.Column{InvitationStatesColumns[3]},
			},
		},
	}
	// ReminderStatesColumns holds the columns for the "reminder_states" table.
	ReminderStatesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "calendar_id", Type: field.TypeString},
		{Name: "uid", Type: field.TypeString},
		{Name: "occurrence_start", Type: field.TypeTime},
		{Name: "minutes", Type: field.TypeInt},
		{Name: "fired_at", Type: field.TypeTime},
		{Name: "snoozed_until", Type: field.TypeTime, Nullable: true},
	}
	// ReminderStatesTable holds the schema information for the "reminder_states" table.
	ReminderStatesTable = &schema.Table{
		Name:       "reminder_states",
		Columns:    ReminderStatesColumns,
		PrimaryKey: []*schema.Column{ReminderStatesColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "reminderstate_calendar_id_uid_occurrence_start_minutes",
				Unique:  true,
				Columns: []*schema.Column{ReminderStatesColumns[1], ReminderStatesColumns[2], ReminderStatesColumns[3], ReminderStatesColumns[4]},
			},
			{
				Name:    "reminderstate_occurrence_start",
				Unique:  false,
				Columns: []*schema.Column{ReminderStatesColumns[3]},
			},
		},
	}
	// SecretsColumns holds the columns for the "secrets" table.
	SecretsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, Unique: true, Size: 64},
		{Name: "key", Type: field.TypeString},
		{Name: "value", Type: field.TypeBytes},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "account_secrets", Type: field.TypeString, Size: 64},
	}
	// SecretsTable holds the schema information for the "secrets" table.
	SecretsTable = &schema.Table{
		Name:       "secrets",
		Columns:    SecretsColumns,
		PrimaryKey: []*schema.Column{SecretsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "secrets_accounts_secrets",
				Columns:    []*schema.Column{SecretsColumns[5]},
				RefColumns: []*schema.Column{AccountsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "secret_key_account_secrets",
				Unique:  true,
				Columns: []*schema.Column{SecretsColumns[1], SecretsColumns[5]},
			},
		},
	}
	// TasksColumns holds the columns for the "tasks" table.
	TasksColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, Unique: true, Size: 64},
		{Name: "uid", Type: field.TypeString},
		{Name: "remote_id", Type: field.TypeString, Nullable: true},
		{Name: "etag", Type: field.TypeString, Nullable: true},
		{Name: "summary", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "location", Type: field.TypeString, Nullable: true},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"needs_action", "in_process", "completed", "cancelled"}, Default: "needs_action"},
		{Name: "priority", Type: field.TypeInt, Default: 0},
		{Name: "percent_complete", Type: field.TypeInt, Default: 0},
		{Name: "due", Type: field.TypeTime, Nullable: true},
		{Name: "start", Type: field.TypeTime, Nullable: true},
		{Name: "completed", Type: field.TypeTime, Nullable: true},
		{Name: "all_day", Type: field.TypeBool, Default: false},
		{Name: "due_tz", Type: field.TypeString, Nullable: true},
		{Name: "start_tz", Type: field.TypeString, Nullable: true},
		{Name: "parent_uid", Type: field.TypeString, Nullable: true},
		{Name: "recurrence", Type: field.TypeJSON, Nullable: true},
		{Name: "reminders", Type: field.TypeJSON, Nullable: true},
		{Name: "categories", Type: field.TypeJSON, Nullable: true},
		{Name: "raw_ics", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "created", Type: field.TypeTime},
		{Name: "updated", Type: field.TypeTime},
		{Name: "calendar_tasks", Type: field.TypeString, Size: 64},
	}
	// TasksTable holds the schema information for the "tasks" table.
	TasksTable = &schema.Table{
		Name:       "tasks",
		Columns:    TasksColumns,
		PrimaryKey: []*schema.Column{TasksColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "tasks_calendars_tasks",
				Columns:    []*schema.Column{TasksColumns[23]},
				RefColumns: []*schema.Column{CalendarsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "task_uid_calendar_tasks",
				Unique:  true,
				Columns: []*schema.Column{TasksColumns[1], TasksColumns[23]},
			},
			{
				Name:    "task_due",
				Unique:  false,
				Columns: []*schema.Column{TasksColumns[10]},
			},
			{
				Name:    "task_status",
				Unique:  false,
				Columns: []*schema.Column{TasksColumns[7]},
			},
		},
	}
	// Tables holds all the tables in the schema.
	Tables = []*schema.Table{
		AccountsTable,
		CalendarsTable,
		EventsTable,
		InvitationStatesTable,
		ReminderStatesTable,
		SecretsTable,
		TasksTable,
	}
)

func init() {
	CalendarsTable.ForeignKeys[0].RefTable = AccountsTable
	EventsTable.ForeignKeys[0].RefTable = CalendarsTable
	SecretsTable.ForeignKeys[0].RefTable = AccountsTable
	TasksTable.ForeignKeys[0].RefTable = CalendarsTable
}
