export interface Client {
    // columns
    id: string;
    name: string;
    organization_id: string;
    created_at: string | null;
    updated_at: string | null;
    // relations
    organization: Organization;
}

export interface Membership {
    // columns
    id: string;
    organization_id: string;
    user_id: string;
    role: string | null;
    created_at: string | null;
    updated_at: string | null;
}

export interface Organization {
    // columns
    id: string;
    user_id: string;
    name: string;
    personal_team: boolean;
    currency: string;
    created_at: string | null;
    updated_at: string | null;
    // relations
    owner: Pick<User, 'id' | 'name' | 'profile_photo_url'>;
}

export interface OrganizationInvitation {
    // columns
    id: string;
    organization_id: string;
    email: string;
    role: string | null;
    created_at: string | null;
    updated_at: string | null;
    // relations
    organization: Organization;
    team: Organization;
}

export interface Project {
    // columns
    id: string;
    name: string;
    color: string;
    client_id: string | null;
    organization_id: string;
    created_at: string | null;
    updated_at: string | null;
    // relations
    organization: Organization;
    client: Client;
    tasks: Task[];
}

export interface Task {
    // columns
    id: string;
    name: string;
    project_id: string;
    organization_id: string;
    created_at: string | null;
    updated_at: string | null;
    // relations
    project: Project;
    organization: Organization;
}

type OrganizationWithMembership = Organization & { membership: Membership };

export interface User {
    // columns
    id: string;
    name: string;
    email: string;
    pending_email: string | null;
    email_verified_at: string | null;
    password?: string;
    remember_token?: string | null;
    current_team_id: string | null;
    profile_photo_path: string | null;
    created_at: string | null;
    updated_at: string | null;
    two_factor_secret?: string | null;
    two_factor_recovery_codes?: string | null;
    two_factor_confirmed_at: string | null;
    timezone: string;
    week_start: string;
    // mutators
    profile_photo_url: string;
    // relations
    organizations: Organization[];
    clients: Client[];
    current_team: Organization;
    all_teams: OrganizationWithMembership[];
    owned_teams: Organization[];
    teams: Organization[];
}
