import {
prepareCreditCarry,
type AnnualBook,
} from '@/lib/irpc-annual-settlement';
import {
carrySource,
newCarryLot,
newCarryUse,
type CarryLot,
type CreditCarry,
} from '@/lib/irpc-credit-carry';
import CountrySelect, { type Country } from '@/components/country-select';
import { countryIsoCodes } from '@/lib/country-iso-codes';
const pt = new Intl.DisplayNames(['pt'], { type: 'region' });
const en = new Intl.DisplayNames(['en'], { type: 'region' });
const countries: Country[] = countryIsoCodes
.filter((code) => code !== 'MZ')
.map((code) => ({
code,
name: pt.of(code) ?? code,
name_en: en.of(code) ?? code,
}))
.sort((a, b) => a.name.localeCompare(b.name, 'pt'));
export function SimulationIrpcCarry({
book,
save,
}: {
book: AnnualBook;
save: (book: AnnualBook) => void;
}) {
const c = book.creditCarry;
if (!c)
return (
);
const update = (value: CreditCarry) =>
save({ ...book, creditCarry: value });
const lotChange = (r: CarryLot) =>
update({ ...c, lots: c.lots.map((x) => (x.id === r.id ? r : x)) });
return (
);
}