type NullStr = null | string;

export type TChildren = {
  children: React.ReactNode;
};
export interface IVerifyOtp {
  message: string;
  token: string;
  user_type: string;
  step: string;
  page: string;
  id: string;
  auth_provider?: "mobile" | "google";
  email?: string | null;
}
export interface Academy {
  academy_image:string,
  academy_name:string,
  userId:string
  rate: number,
  number_of_rate:number,
  sheba:string,
  bio:string,
  tag?: string;
}

export interface Video {
  id?: string;
  title: string;
  url: string;
  isFree: boolean;
}

export interface Course {
  id?: string;
  _id?: string;
  name: string;
  discount: number;
  duration: string;
  videoCount: number;
  finalPrice: number;
  offerNumber: number;
  instructor: string;
  packageImage: string;
  videos: Video[];
  createdAt?: Date;
  price:string | string,
  cuorse_name: string,
  category:string,
  offer: string,
  academyId: string,
  caption: string,
  status: string,
  user_id:string,
  likes: string,
  comments:Object,
  type:string,
  course_time:string,
  number_of_course_content: string
  teacher_number:string,
  teacher_name:string,
  course_image: string

  
}

export interface IExpertise {
  _id: string;
  expertise: string;
  sub_expertise: ISubExpertise[];
}

export interface ISubExpertise {
  name: string;
  _id: string;
}
export interface LastPost {
  _id: string;
  post_image: string;
  post_images?: string[]; // اضافه شد
  caption: string;
  user_id: string;
  updatedAt: string;
  createdAt: string;
  __v: number;
  status: string;
  likesCount: number;
  is_liked: boolean;
}

export interface IProfileData {
  _id: string;
  user_type: NullStr;
  user_level: NullStr;
  first_name: NullStr;
  last_name: NullStr;
  user_name: NullStr;
  show_location: boolean;
  is_verified: NullStr;
  user_score: NullStr;
  rate: NullStr;
  bio: NullStr;
  height: NullStr;
  weight: NullStr;
  size: NullStr;
  eye_color: NullStr;
  hair_color: NullStr;
  profile_image: NullStr;
  lat: NullStr;
  lng: NullStr;
  address: NullStr;
  province: IProvince;
  city: ICity;
  shaba: NullStr;
  national_code: string;
  mobile: string;
  cooperation_abroad: boolean;
  cooperation_type: NullStr;
  conversation_projects: NullStr;
  expertise: NullStr;
  sub_expertise: string[] | NullStr;
  isRegister: boolean;
  services: NullStr;
}

export interface IProvince {
  _id: string;
  id: number;
  name: string;
  slug: string;
}

export interface ICity {
  _id: string;
  id: number;
  name: string;
  slug: string;
  province_id: number;
}
export interface Service {
  id: string;
  _id?: string;
  title: string;
  originalPrice: string;
  discountPrice: NullStr;
  status : string
  image?: NullStr;
  discountPercentage?: number | NullStr;
}

// Posts
export interface UserGet {
  users: User[];
  totalPages: number;
  totalItems: number;
}

export interface User {
  _id: string;
  user_id: string;
  expertise: string;
  eye_color?: string;
  first_name: string;
  hair_color?: string;
  height?: string;
  is_verified: string;
  last_name: string;
  last_post: LastPost;
  profile_image?: string;
  rate?: string;
  size?: string;
  is_Register?: string;
  user_level?: string;
  user_name: string;
  user_score?: string;
  weight?: string;
  services?: Service[];
  commentsCount?: number | string;
  is_self?: boolean | string;
  last_online?: string;
  created_at?: string;
  user_type?: string;
  show_location?: boolean;
  bio?: string;
  lat?: string;
  lng?: string;
  address?: string;
  is_blocked?: boolean;
  blocked_you?: boolean;
  offer_status?: boolean | null;
  sub_expertise?: string[];
  postsCount?: number | undefined;
  allProjectsCount?: number | undefined;
  successfulProjectsCount?: number | undefined;
  mobile?: string;
  email?: string;
  auth_provider?: "mobile" | "google";
  isRegister?: boolean;
  city?: ICity;
  province?: IProvince;
  shaba?: string | null;
  national_code?: string | null;
  cooperation_abroad?: boolean | null | undefined;
  conversation_projects?: boolean | null | undefined;
  posts?: Post[];
  hasUsedFreeOffer?: boolean; // 👈 اضافه شد

}

export interface LastPost {
  _id: string;
  post_image: string;
  caption: string;
  user_id: string;
  updatedAt: string;
  createdAt: string;
  __v: number;
  status: string;
  likesCount: number;
  is_liked: boolean;
}

export interface UserPost {
  _id: string;
  post_image: string;
  caption: string;
  user_id: string;
  likes: string[];
  comments: [];
  updatedAt: string;
  createdAt: string;
  __v: number;
  status: string;
}
export interface Installment {
  installment_number: number;
  amount: number;
  due_date: string;
  _id: string;
}

export interface IProjectCreator {
  _id: string;
  first_name: string;
  last_name: string;
  user_name: string;
  profile_image: string;
  is_verified: string;
  rate: number | null;
  user_type: string;
  city: ICity;
  province: IProvince;
  gender: string | null;
}

export interface Project {
  acceptedAt: string | null;
  isExpired: boolean;
  _id: string;
  title: string;
  expertise: string;
  sub_expertise: string[];
  gender: string;
  age: string;
  conversation_projects: boolean;
  province: IProvince;
  city: ICity;
  offer_time: string;
  offer_price: number;
  description: string;
  project_type: string;
  payment_status: string | null;
  status: string;
  public_status: string;
  created_for_user: string | null;
  creator_id: string;
  requested_users: string[];
  selected_user: string | null | SelectedUser;
  final_price: number | null;
  final_time: number | null;
  reject_reason: string | null;
  installments: Installment[];
  ratings: string[];
  updatedAt: string;
  createdAt: string;
  __v: number;
  remainingTime: string;
  creator: IProjectCreator;
  status_filter?: string;
  numberOfPerson?: string;
}
export interface SelectedUser {
  _id: string;
  city: ICity;
  expertise: string;
  first_name: string;
  is_verified: string;
  last_name: string;
  profile_image: string;
  province: IProvince;
  rate: string;
  sub_expertise: string[];
  user_level: string;
  user_name: string;
  user_score: string;
  user_type: string;
}

export interface IProjectRequest {
  _id: string;
  project: string;
  user: IProjectRequestUser;
  time: number | string;
  price: number | string;
  status: string;
  updatedAt: string;
  createdAt: string;
  __v: number;
}
export interface FileData {
  path: string;
  type: "image" | "video";
}


export interface IProjectRequestUser {
  _id: string;
  first_name: string;
  is_verified: string;
  last_name: string;
  profile_image: string;
  rate: string;
  user_level: string;
  user_name: string;
  user_score: string;
}
export interface IRating {
  userId: string;
  rating: number;
}
export interface IRate {
  adAverageRating: number;
  adTotalRatings: number;
}

export interface IFeature {
  title?: string;
  value: boolean;
  _id?: string;
}

export interface IContactInfo {
  phone?: string;
  mobile?: string;
  telegramLink?: string;
  whatsappNumber?: string;
  instagramLink?: string;
  saveInfoForNextAds: boolean;
}
export interface IAdvertising {
  _id: string;
  title: string;
  category?: string;
  description?: string | null;
  province: IProvince;
  city: ICity;
  neighbourhood?: string;
  address?: string;
  lat?: string | undefined;
  lng?: string | undefined;
  images?: string[];
  services?: Service[];
  features?: IFeature[];
  contactInfo?: IContactInfo;
  type: "free" | "normal" | "special" | "highlight";
  status?: "pre_payment" | "paid" | "accepted" | "rejected" | "expired";
  payment_status?: string;
  creator_id?: string;
  reject_reason?: string;
  mostDiscountPercentage?: number;
  showDiscount?: boolean;
  likesCount: number;
  commentsCount: number;
  ratings?: IRating[];
  averageRating?: number;
  ratingsCount?: number;
  viewCount: number;
  acceptedAt?: string | null;
  createdAt?: string;
  updatedAt?: string;
  rate?: IRate;
  likedByUser: boolean | null;
  remainingTime?: string;
  creatorId?: string | null;
}

export interface UserComment {
  user: string;
  creator: string;
  rating: number;
  comment: string;
  comment_for: "user";
  status: "pending" | "approved" | "rejected";
}

type PostFile = {
  path: string;
  type: "image" | "video";
};



export interface Post {
  _id: string;
  user_id: string;
  user_name: string;
  first_name: string;
  last_name: string;
  expertise?: string;
  province?: { id: string; name: string; slug: string; _id?: string };
  city?: { id: string; name: string; slug: string; province_id: number; _id?: string };
  user_level?: string;
  post_image?: string;
  post_images?: string[];
  caption?: string;
  status?: string;
  likes?: string[];
  comments?: UserComment[];
  createdAt: string;
  updatedAt: string;
  likesCount: number;
  is_liked: boolean;
  commentsCount: number;
  rate?: number;
  type?: string;
  files: PostFile[];
  userId: string;
  profile_image?: string;
  sub_expertise?: string[];
}


export interface ITicket {
  _id: string;
  title: string;
  status: string;
  user: string;
  new_message: boolean;
  updatedAt: string;
  createdAt: string;
  __v: number;
}

export interface IOffers {
  _id: string;
  sender: ISender;
  receiver: IReceiver;
  status: string;
  transaction_id: string;
  updatedAt: string;
  createdAt: string;
  __v: number;
}

export interface ISender {
  _id: string;
  first_name: string;
  is_verified: string;
  last_name: string;
  profile_image: string;
  rate: string | null;
  user_level: string | null;
  user_name: string;
  user_score: string | null;
}

export interface IReceiver {
  _id: string;
  first_name: string;
  is_verified: string;
  last_name: string;
  profile_image: string;
  rate: string | null;
  user_level: string | null;
  user_name: string;
  user_score: string | null;
}

export interface IProjectType {
  name: string;
  price: string | number;
  _id: string;
}
export interface IOfferType {
  name: string;
  _id: string;
  price: string | number;
}
export interface IAdvertisingCategory {
  _id: string;
  title: string;
  status: boolean;
}
export interface Province {
  id: string | number;
  name: string;
}
export interface City {
  id: string | number;
  name: string;
}

export interface IAdvertisingType {
  name: string;
  price: string | number;
  _id: string;
}
export interface IAdvertisingProfile {
  _id: string;
  profile_image: string | null;
  vitrine_name: string | null;
  category: string | null;
  about_us: string | null;
  province: IProvince | null;
  city: ICity | null;
  lat: string | null;
  lng: string | null;
  neighbourhood: string | null;
  adTotalRatings: number;
  adRatingsCount: number;
  adAverageRating: number;
  contactInfo: IContactInfo;
  address: string | null;
  allImages: string[];
  allServices: Service[];
  allFeatures: IFeature[];
  totalCommentsCount: number;
  totalLikesCount: number;
  is_self: boolean;
}
