export interface OfficialKyosaiField {
  id: number;
  k_num: string;
  s_num: string;
  address: string;
  kanji_name: string;
  area: number;
  linked_field_names?: string[];
}

export interface OfficialChusankanField {
  id: number;
  c_id: string;
  oaza: string;
  aza: string;
  chiban: string;
  area: number;
  payment_amount: number | null;
  linked_field_names?: string[];
}

export interface Field {
  id: number;
  name: string;
  address: string;
  area_tan: string;
  area_m2: number;
  owner_name: string;
  group_name: string | null;
  display_order: number;
  kyosai_fields: OfficialKyosaiField[];
  chusankan_fields: OfficialChusankanField[];
}

export interface Variety {
  id: number;
  crop: number;
  name: string;
}

export interface Crop {
  id: number;
  name: string;
  varieties: Variety[];
}

export interface Plan {
  id: number;
  field: number;
  field_name: string;
  year: number;
  crop: number;
  crop_name: string;
  variety: number;
  variety_name: string;
  notes: string | null;
}

export interface Fertilizer {
  id: number;
  name: string;
  maker: string | null;
  capacity_kg: string | null;
  nitrogen_pct: string | null;
  phosphorus_pct: string | null;
  potassium_pct: string | null;
  notes: string | null;
}

export interface FertilizationEntry {
  id?: number;
  field: number;
  field_name?: string;
  field_area_tan?: string;
  fertilizer: number;
  fertilizer_name?: string;
  bags: number;
}

export interface FertilizationPlan {
  id: number;
  name: string;
  year: number;
  variety: number;
  variety_name: string;
  crop_name: string;
  entries: FertilizationEntry[];
  field_count: number;
  fertilizer_count: number;
  created_at: string;
  updated_at: string;
}

export interface MailSender {
  id: number;
  type: 'address' | 'domain';
  email: string | null;
  domain: string | null;
  rule: 'never_notify' | 'always_notify';
  note: string;
  created_at: string;
}

export interface MailEmailFeedback {
  id: number;
  sender_email: string;
  sender_domain: string;
  subject: string;
  body_preview: string;
  received_at: string;
  feedback: 'important' | 'not_important' | 'never_notify' | 'always_notify' | null;
}
