import ICalendarEvent from "@/interfaces/ICalendarEvent";

export interface Permission {
	resource: string;
	action: string;
}
// Role type as a string literal
export interface Role {
	id: string;
	name: string;
	permissions?: Permission[];
}

// Status type as a string literal
export type Status = "Active" | "Inactive";

// Event type (you can expand this type as needed based on your schema)
export interface Event {
	eventID: string;
	title: string;
	date: string; // Assuming ISO date string
}

// Blog type (you may already have this defined as shown in your previous example)
export interface Blog {
	blogID: string;
	slug: string;
	content: string;
	category?: string;
	title: string;
	authorID: string;
	published: string;
	summary?: string;
	image?: string;

	author: User; // Relation to User
}

export interface Category {
	category: string;
	count: number;
}

export type NewBlog = Omit<
	Blog,
	"blogID" | "authorID" | "author" | "published"
>;

// User type definition
export interface User {
	userId: string; // UUID represented as a string
	firstname: string;
	lastname: string;
	email: string;
	password?: string; // Optional field, since it's omitted in the JSON
	phone: string;
	createdAt: string; // ISO date string
	updatedAt: string; // ISO date string

	events?: Event[]; // Many-to-many relation with Event (optional)
	articles?: Blog[]; // One-to-many relation with Blog (optional)
	roles?: Role[];
}

export interface ApiResponse<T> {
	status: "Error" | "Success";
	message: string;
	data?: T;
}

export interface Location {
	id?: number;
	street: string;
	city: string;
	postalCode: string;
	latitude?: number;
	longitude?: number;
	events?: ICalendarEvent[];
}

// types/types.ts
export interface OpenStreetMapLocation {
	place_id: string; // Unique identifier for the location
	licence: string; // Licensing information
	osm_type: string; // e.g., "node", "way", "relation"
	osm_id: string; // OSM-specific ID
	lat: string; // Latitude
	lon: string; // Longitude
	display_name: string; // Human-readable full address
	address: {
		house_number?: string; // House number (optional)
		road?: string; // Street name (optional)
		neighbourhood?: string; // Neighborhood (optional)
		suburb?: string; // Suburb (optional)
		city?: string; // City (optional)
		town?: string; // Town (fallback for city)
		village?: string; // Village (fallback for city)
		county?: string; // County (optional)
		state?: string; // State or region (optional)
		postcode?: string; // Postal code (optional)
		country?: string; // Country (optional)
		country_code?: string; // ISO country code (e.g., "fr")
		[key: string]: string | undefined; // Allow for additional fields
	};
}
